internal async void StopServer() { Running = false; await server.Stop(); StopSignal.Set(); }
private void Stop() { if (WorkerSettings.Multithreaded) { // Signal the thread to stop StopSignal.Set(); // Wait ten seconds for the thread to finish ExitedSignal.WaitOne(10 * 1000); // Reset the stop and exited flags so that the thread can be restarted StopSignal.Reset(); ExitedSignal.Reset(); } else { ThreadTeardown(); } }