-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
MVM_get_running_threads_context
to get the running thread's con…
…text Start with a fallback implementation using `uv_key_create`, `uv_key_set` and `uv_key_get`, to eliminate the static variable and make the code thread safe. Use this in `qsort`'s callback, which needs to call functions that take the thread context pointer, but has no way to pass this in. The standard C library function `qsort` takes a callback function to compare two elements, which is only passed two arguments - pointers to the two elements to compare. As our elements are MVMString pointers, we *also* need a thread context pointer to pass to `MVM_string_compare`. This had been implemented by passing the thread context pointer "via" a static variable. This is obviously not thread safe, but we've got away with it so far, probably because we rarely throw exceptions in this code.
- Loading branch information
Showing
4 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters