Browse Source

Use while loop instead of if for removing as much stalled tickets as possible

Jérémie Laval 15 years ago
parent
commit
4b446ed05a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      mcs/class/corlib/System.Threading/SpinLock.cs

+ 2 - 2
mcs/class/corlib/System.Threading/SpinLock.cs

@@ -109,7 +109,7 @@ namespace System.Threading
 				while (slot != ticket.Value) {
 					wait.SpinOnce ();
 
-					if (stallTickets != null && stallTickets.TryRemove (ticket.Value))
+					while (stallTickets != null && stallTickets.TryRemove (ticket.Value))
 						++ticket.Value;
 				}
 			} finally {
@@ -148,7 +148,7 @@ namespace System.Threading
 			bool stop = false;
 
 			do {
-				if (stallTickets != null && stallTickets.TryRemove (ticket.Value))
+				while (stallTickets != null && stallTickets.TryRemove (ticket.Value))
 					++ticket.Value;
 
 				long u = ticket.Users;