CHG: passive wait on DequeueWorkItem

(cherry picked from commit ac49cc8dce0519e29f26cacc5e785134300c6639)
This commit is contained in:
Michal Staszewski
2011-06-21 14:44:04 +02:00
committed by Piotr Wysocki
parent ea804bada0
commit 4b16bf08ce
+3 -13
View File
@@ -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[] {