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