public void Pause() { if(active) { lock(lockObject) { var token = cts; token.Cancel(); thread.Join(); thread = null; } } }