public static bool TryLock(RubyMutex /*!*/ self) { bool lockTaken = false; try { MonitorUtils.TryEnter(self._mutex, ref lockTaken); } finally { if (lockTaken) { self._isLocked = true; } } return(lockTaken); }