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/System.Private.CoreLib/src/System/Threading | |
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/System.Private.CoreLib/src/System/Threading')
-rw-r--r-- | src/System.Private.CoreLib/src/System/Threading/Monitor.cs | 10 | ||||
-rw-r--r-- | src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/System.Private.CoreLib/src/System/Threading/Monitor.cs b/src/System.Private.CoreLib/src/System/Threading/Monitor.cs index a123f067e3..4385bf9992 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Monitor.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Monitor.cs @@ -20,6 +20,7 @@ using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using System.Diagnostics; +using System.Runtime.InteropServices; namespace System.Threading { @@ -236,10 +237,9 @@ namespace System.Threading /// <summary> /// Gets the number of times there was contention upon trying to take a <see cref="Monitor"/>'s lock so far. /// </summary> - public static extern long LockContentionCount - { - [MethodImpl(MethodImplOptions.InternalCall)] - get; - } + public static long LockContentionCount => GetLockContentionCount(); + + [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] + private static extern long GetLockContentionCount(); } } diff --git a/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs b/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs index d7b2c2741a..eac84d4dbe 100644 --- a/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs @@ -254,11 +254,10 @@ namespace System.Threading /// <remarks> /// For a thread pool implementation that may have different types of work items, the count includes all types. /// </remarks> - public static extern long CompletedWorkItemCount - { - [MethodImpl(MethodImplOptions.InternalCall)] - get; - } + public static long CompletedWorkItemCount => GetCompletedWorkItemCount(); + + [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] + private static extern long GetCompletedWorkItemCount(); private static extern long PendingUnmanagedWorkItemCount { |