Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Update src/coreclr/nativeaot/Runtime/HandleTableHelpers.cpp
  • Loading branch information
jkotas authored and github-actions committed Dec 18, 2024
commit 71d73ec31f6805a1b2ced2af89a4e6bf5e053630
6 changes: 3 additions & 3 deletions src/coreclr/nativeaot/Runtime/HandleTableHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ static ManagedObjectWrapper* ToManagedObjectWrapper(void* dispatchPtr)
}

//
// AddRef is implemented in native code so that it can be invoked during a GC. This is important because Xaml invokes AddRef
// while holding a lock that it *also* holds while a GC is in progress. If AddRef was managed, we would have to synchronize
// with the GC before entering AddRef, which would deadlock with the other thread holding Xaml's lock.
// AddRef is implemented in native code so that it does not need to synchronize with the GC. This is important because Xaml
// invokes AddRef while holding a lock that it *also* holds while a GC is in progress. If AddRef was managed, we would have
// to synchronize with the GC before entering AddRef, which would deadlock with the other thread holding Xaml's lock.
//
static uint32_t __stdcall IUnknown_AddRef(void* pComThis)
{
Expand Down