You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Web.JS] call mono_wasm_gc_lock in MonoHeapLock (#46909)
Take the runtime's GC lock when creating a heap lock.
**Important Notes**
1. While the runtime GC lock is locked, calling any C# function or doing anything that may trigger managed allocation will block the runtime.
2. In a threaded build, only the main browser thread is allowed to call the `mono_wasm_gc_lock` function
3. The runtime lock is not recursive
4. Background threads initially continue running, so the managed object graph may change even while the GC lock is held (although objects may not move). Background threads could mutate valuetype fields of reachable objects, even while the GC lock is held. However background threads will block as soon as they try to do any allocation.
5. The main browser thread may assume that managed heap objects will not move while the lock is held.
Corresponding runtime change dotnet/runtime#82646
0 commit comments