mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-22 07:01:18 +03:00
CHG: passive wait on DequeueWorkItem
(cherry picked from commit ac49cc8dce0519e29f26cacc5e785134300c6639)
This commit is contained in:
committed by
Piotr Wysocki
parent
ea804bada0
commit
4b16bf08ce
@@ -177,14 +177,8 @@ namespace Amib.Threading.Internal
|
||||
|
||||
WaiterEntry waiterEntry;
|
||||
WorkItem workItem = null;
|
||||
|
||||
try
|
||||
{
|
||||
while (!Monitor.TryEnter(this)) { }
|
||||
//Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
//Monitor.Enter(this);
|
||||
//stopwatch.Stop();
|
||||
|
||||
lock (this)
|
||||
{
|
||||
ValidateNotDisposed();
|
||||
|
||||
// If there are waiting work items then take one and return.
|
||||
@@ -201,11 +195,7 @@ namespace Amib.Threading.Internal
|
||||
|
||||
// Put the waiter with the other waiters
|
||||
PushWaiter(waiterEntry);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare array of wait handle for the WaitHandle.WaitAny()
|
||||
WaitHandle [] waitHandles = new WaitHandle[] {
|
||||
|
||||
Reference in New Issue
Block a user