public void StartWork() { if (thread == null) { thread = new Thread(new ThreadStart(Loop)); thread.Start(); } else { WaitForWork.Set(); } }
internal void Stop() { cancellationTokenSource.Cancel(); WaitForWork.Set(); }