diff options
author | Stephen Toub <stoub@microsoft.com> | 2017-09-27 06:18:44 +0300 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2017-09-27 06:18:44 +0300 |
commit | 5c202338706f3d33b28fa908ca9a4361b0b47441 (patch) | |
tree | c27ccda000524e756b2c38d2f7bb1559615aea35 | |
parent | 3828955600cbc07cc8a072b1a82c10fb0f9bde0a (diff) |
Add ThreadPool.QueueUserWorkItem(..., bool preferLocal)
-rw-r--r-- | src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs b/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs index e43665391..2c382076c 100644 --- a/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs +++ b/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs @@ -1014,9 +1014,12 @@ namespace System.Threading } public static bool QueueUserWorkItem(WaitCallback callBack) => - QueueUserWorkItem(callBack, null); + QueueUserWorkItem(callBack, null, preferLocal: false); - public static bool QueueUserWorkItem(WaitCallback callBack, object state) + public static bool QueueUserWorkItem(WaitCallback callBack, object state) => + QueueUserWorkItem(callBack, state, preferLocal: false); + + public static bool QueueUserWorkItem(WaitCallback callBack, object state, bool preferLocal) { if (callBack == null) { @@ -1029,7 +1032,7 @@ namespace System.Threading new QueueUserWorkItemCallbackDefaultContext(callBack, state) : (IThreadPoolWorkItem)new QueueUserWorkItemCallback(callBack, state, context); - ThreadPoolGlobals.workQueue.Enqueue(tpcallBack, forceGlobal: true); + ThreadPoolGlobals.workQueue.Enqueue(tpcallBack, forceGlobal: !preferLocal); return true; } |