public bool Stop() { // Try to move to stopping state if (Interlocked.CompareExchange(ref _state, 3, 2) != 2) { // Wasn't running return false; } return true; }