public SuspenderToken Get() { lock (_lock) { SuspenderToken s = new SuspenderToken(this); _list.Add(s); return(s); } }
public SuspenderToken Get() { _wlock.EnterWriteLock(); try { SuspenderToken s = new SuspenderToken(this); _list.Add(s); return(s); } finally { _wlock.ExitWriteLock(); } }
public void Resume(SuspenderToken s) { lock (_lock) { _list.Remove(s); if (_list.Count > 0) { return; } } // try { _action?.Invoke(); } // catch (Exception) { } }
public void Resume(SuspenderToken s) { _wlock.EnterWriteLock(); try { _list.Remove(s); if (_list.Count > 0) { return; } } finally { _wlock.ExitWriteLock(); } // try { _action?.Invoke(); } // catch (Exception) { } }