internal void Exit(ref bool lockTaken) { try { MonitorUtils.Exit(this, ref lockTaken); } finally { if (!lockTaken) { _locked--; } } }
public static RubyMutex /*!*/ Unlock(RubyMutex /*!*/ self) { bool lockTaken = true; try { MonitorUtils.Exit(self._mutex, ref lockTaken); } finally { if (!lockTaken) { self._isLocked = false; } } return(self); }
public static object Synchronize(BlockParam criticalSection, RubyMutex /*!*/ self) { bool lockTaken = false; try { MonitorUtils.Enter(self._mutex, ref lockTaken); self._isLocked = lockTaken; object result; criticalSection.Yield(out result); return(result); } finally { if (lockTaken) { MonitorUtils.Exit(self._mutex, ref lockTaken); self._isLocked = lockTaken; } } }