diff options
author | Koundinya Veluri <kouvel@users.noreply.github.com> | 2019-05-14 15:10:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-14 15:10:17 -0700 |
commit | fd2287c5e833439e0ea7c27ad14350bcccf371a0 (patch) | |
tree | 738e1dec19d4402f070a1e6ebcf04cc7a255e300 /src/classlibnative | |
parent | 5f09000ba82d21e04857941b9a087679dd0ea686 (diff) | |
download | coreclr-fd2287c5e833439e0ea7c27ad14350bcccf371a0.tar.gz coreclr-fd2287c5e833439e0ea7c27ad14350bcccf371a0.tar.bz2 coreclr-fd2287c5e833439e0ea7c27ad14350bcccf371a0.zip |
Fix a contract violation in ThreadPool.get_CompletedWorkItemCount (#24535)
Fix a contract violation in ThreadPool.get_CompletedWorkItemCount
Fixes https://github.com/dotnet/coreclr/issues/24515
- Looks like the path that acquires the thread store lock has code that is marked witH GC_TRIGGERS
- Changed ThreadPool.get_CompletedWorkItemCount and Monitor.get_LockContentionCount to use QCalls instead of FCalls
Diffstat (limited to 'src/classlibnative')
-rw-r--r-- | src/classlibnative/bcltype/objectnative.cpp | 15 | ||||
-rw-r--r-- | src/classlibnative/bcltype/objectnative.h | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/classlibnative/bcltype/objectnative.cpp b/src/classlibnative/bcltype/objectnative.cpp index 14e4cee002..dc4fd92209 100644 --- a/src/classlibnative/bcltype/objectnative.cpp +++ b/src/classlibnative/bcltype/objectnative.cpp @@ -342,9 +342,16 @@ FCIMPL1(FC_BOOL_RET, ObjectNative::IsLockHeld, Object* pThisUNSAFE) } FCIMPLEND -FCIMPL0(INT64, ObjectNative::GetMonitorLockContentionCount) +INT64 QCALLTYPE ObjectNative::GetMonitorLockContentionCount() { - FCALL_CONTRACT; - return (INT64)Thread::GetTotalMonitorLockContentionCount(); + QCALL_CONTRACT; + + INT64 result = 0; + + BEGIN_QCALL; + + result = (INT64)Thread::GetTotalMonitorLockContentionCount(); + + END_QCALL; + return result; } -FCIMPLEND diff --git a/src/classlibnative/bcltype/objectnative.h b/src/classlibnative/bcltype/objectnative.h index 3d008d95a9..f5583cf44d 100644 --- a/src/classlibnative/bcltype/objectnative.h +++ b/src/classlibnative/bcltype/objectnative.h @@ -38,7 +38,7 @@ public: static FCDECL1(void, Pulse, Object* pThisUNSAFE); static FCDECL1(void, PulseAll, Object* pThisUNSAFE); static FCDECL1(FC_BOOL_RET, IsLockHeld, Object* pThisUNSAFE); - static FCDECL0(INT64, GetMonitorLockContentionCount); + static INT64 QCALLTYPE GetMonitorLockContentionCount(); }; #endif // _OBJECTNATIVE_H_ |