Fix the mobile build
[mono.git] / mcs / class / corlib / System.Threading / SpinLock.cs
index 4357b30e8f31bcc16a7de7fc3bbb842cf3bf3792..a14899c6d1902cd4272eca518c160d38d0506dd7 100644 (file)
@@ -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;
@@ -169,6 +169,7 @@ namespace System.Threading
                } while (!stop && (millisecondsTimeout == -1 || (sw.ElapsedMilliseconds - start) < millisecondsTimeout));
                }
 
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                public void Exit ()
                {
                        Exit (false);