Changed Monitor.TryEnter(...) to lock(...) {}

This commit is contained in:
Ami Bar
2011-07-11 09:12:49 +03:00
parent 6903f4ca29
commit d1456b904d
+1 -6
View File
@@ -178,9 +178,8 @@ namespace Amib.Threading.Internal
WaiterEntry waiterEntry; WaiterEntry waiterEntry;
WorkItem workItem = null; WorkItem workItem = null;
try lock (this)
{ {
while (!Monitor.TryEnter(this)) { }
//Stopwatch stopwatch = Stopwatch.StartNew(); //Stopwatch stopwatch = Stopwatch.StartNew();
//Monitor.Enter(this); //Monitor.Enter(this);
//stopwatch.Stop(); //stopwatch.Stop();
@@ -202,10 +201,6 @@ namespace Amib.Threading.Internal
// Put the waiter with the other waiters // Put the waiter with the other waiters
PushWaiter(waiterEntry); PushWaiter(waiterEntry);
} }
finally
{
Monitor.Exit(this);
}
// Prepare array of wait handle for the WaitHandle.WaitAny() // Prepare array of wait handle for the WaitHandle.WaitAny()
WaitHandle [] waitHandles = new WaitHandle[] { WaitHandle [] waitHandles = new WaitHandle[] {