Commit 27b5d2e
authored
[monodroid] Fix thread state transition in
Fixes: #8253
`get_function_pointer` can be called from any thread. In particular,
it can be called from Android thread pool thread when method
marshaling is used. We need to ensure those threads stay in the GC
safe mode from the runtime perspective once we stop executing user
code on those threads. `mono_thread_attach` switches the thread to GC
unsafe mode and it stays there after we stop executing user code. The
next GC will try to suspend the thread which cannot succeed since
there's no cooperative runtime code running on that thread anymore.
The fix is to use `mono_jit_thread_attach` which mimics what the
iOS/macOS interop does. It creates the necessary MonoVM thread
structures for JIT to work but doesn't transition the thread state.get_function_pointer (#9343)1 parent 230ebb0 commit 27b5d2e
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
0 commit comments