-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[runtime] Implement thread info flags and get rid of tools threads. (m…
…ono#7226) * [acceptance-tests] Revert part of 1216780. This didn't work as well as I'd hoped. * [libgc] Export GC_start_blocking () and GC_end_blocking (). * [libgc] Allow GC_start_blocking ()/GC_end_blocking () to be called unbalanced. This makes things a bit easier in Mono. * [libgc] Implement GC_start_blocking ()/GC_end_blocking () for Windows. * [utils/event] Export the MonoOSEvent APIs for use in the profiler. * [runtime] Implement thread info flags and get rid of tools threads. The concept of a tools thread was originally a good solution to the problem of some internal threads needing to be exempt from stop-the-world. Since they were introduced, however, we've added more code in the profiler's internal threads which require certain properties that don't hold true for tools threads. In particular, we call into some APIs in the metadata layer that, while not needing the managed heap, do need a domain to be set under certain conditions (see mono#6188). To avoid further complicating the semantics of tools thread by trying to set a domain for them in a way that doesn't break things horribly, we'll instead do away with the concept entirely. We already had mono_gc_set_skip_thread () to flag a thread as being exempt from stop-the-world, which we used in thread pool threads. This means we already have the infrastructure that is necessary for a thread to be fully attached to the runtime as a managed thread while still being exempt from stop-the-world. So, we do the following: 1. Introduce a set of flags that can be set on a MonoThreadInfo at arbitrary points (although not in async context). These can indicate that the thread doesn't want to participate in stop-the-world, doesn't want to receive sampling signals, etc. 2. Change the thread iteration macros to allow skipping threads with specific flags set and use this where appropriate (e.g. SGen stop-the-world code). 3. Get rid of mono_gc_set_skip_thread () and make runtime code use the new mono_thread_info_set_flags () instead. 4. Switch all internal profiler threads to using mono_thread_attach () and mono_thread_detach (). Use mono_thread_info_set_flags () to disable stop-the-world and sampling signals for these threads immediately after they start. With these changes, internal profiler threads are now fully attached threads and can call any APIs in the runtime as long as they don't touch the managed heap. * [libgc] Add a note about how GC_start_blocking ()/GC_end_blocking () differ from upstream.
- Loading branch information
Showing
25 changed files
with
439 additions
and
204 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
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
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
Oops, something went wrong.