tryLock method

bool tryLock()

Acquires the mutex immediately if not locked; returns false if already held.

Implementation

bool tryLock() {
  if (_isLocked) return false;
  _isLocked = true;
  return true;
}