-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[threads] Switch foreign threads to GC Safe in mono_thread_detach #42758
Conversation
76f1998
to
84e3094
Compare
@lateralusX I pushed f6e9c01 into this PR to add a call in EventPipe to |
@lambdageek don't worry about that at the moment, as part of #41872 I pushed these methods into support methods that are already hooked up to the function table, so depending on what PR that get merged first we just need to adjust call within that function, eventpipe_thread_attach. |
f6e9c01
to
f6dfe35
Compare
078c2d8
to
ff2f4f9
Compare
Addresses mono/mono#20290 and mono/mono#20283 If a foreign thread (that was created outside the runtime) calls `mono_thread_detach`, leave it in a preemptively-suspendable state, since we can't expect it to coop suspend. Conversely in `mono_thread_attach` (external only), ensure that we always leave the thread in GC Unsafe (aka RUNNING) state, for cases like while (cond) { t = mono_thread_attach (domain); <...> mono_thread_detach (t); } --- To make this work, we also make `mono_thread_detach` and `mono_thread_attach` external only. The runtime should use `mono_thread_internal_detach` and `mono_thread_internal_attach`.
d071f85
to
a4f30d5
Compare
The (Libraries Test Run release mono Linux x64 Debug) failure in SetDateTimeMax is due to #43166 |
!! This PR is a copy of mono/mono#20435, please do not edit or review it in this repo !!
Do not automatically approve this PR:
* Consider how the changes affect configurations in this repo,
* Check effects on files that are not mirrored,
* Identify test cases that may be needed in this repo.
!! Merge the PR only after the original PR is merged !!
Addresses mono/mono#20290 and mono/mono#20283
If a foreign thread (that was created outside the runtime) calls
mono_thread_detach
, leave it in a preemptively-suspendable state, since we can't expect it to coop suspend.Conversely in
mono_thread_attach
(external only), ensure that we always leavethe thread in GC Unsafe (aka RUNNING) state, for cases like
To make this work, we also make
mono_thread_detach
andmono_thread_attach
external only. The runtime should usemono_thread_internal_detach
andmono_thread_internal_attach
.