[2019-10] [threads] Add back mono_threads_attach_tools_thread as a public API#18075
Merged
lambdageek merged 2 commits intomono:2019-10from Dec 6, 2019
Merged
Conversation
In mono@a5da7b2 we got rid of "tools" threads internally to the runtime. However since the API was previously marked with MONO_API it was an internal API that some embedders depended on. This PR adds back an (external-only) limited form of tools thread. The runtime is aware of the Tools thread in that FOREACH_THREAD_* macros will iterate over them, and the thread has a coop thread state machine. (That is, mono_thread_info_current() and GC Safe and GC Unsafe transitions all work.) However the thread is: 1. Not stopped by the GC 2. Is not interrupted by profiler sampling. 3. Does not have a "current domain" 4. (As a consequence of the above) cannot call managed methods or touch managed objects. Such threads are useful for low-level interaction with the runtime such as querying metadata, the JIT state and other coordination. mono_threads_attach_tools_thread should be called no more than once. It should not be called on a thread that is already attached with mono_thread_atach, and vice versa. Addresses mono#18011
lambdageek
approved these changes
Dec 6, 2019
Contributor
|
How is it the author of this PR shows up as monojenkins? |
Member
|
It's a backport. (Technically monojenkins isn't the author, it's the committer and the entity that opened the PR) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a5da7b2
we got rid of "tools" threads internally to the runtime.
However since the API was previously marked with MONO_API it was an internal
API that some embedders depended on.
This PR adds back an (external-only) limited form of tools thread.
The runtime is aware of the Tools thread in that FOREACH_THREAD_* macros will
iterate over them, and the thread has a coop thread state machine. (That is,
mono_thread_info_current() and GC Safe and GC Unsafe transitions all work.)
However the thread is:
objects.
Such threads are useful for low-level interaction with the runtime such as
querying metadata, the JIT state and other coordination.
mono_threads_attach_tools_thread should be called no more than once. It should
not be called on a thread that is already attached with mono_thread_atach, and
vice versa.
Addresses #18011
Backport of #18048.
/cc @lambdageek