private void ShutdownClientHandlerThreads() { lock (sync_) { if (State.SHUTDOWN_COMPLETE != state_) { this.Log("shutting down..."); while (clientThreads_.Count > 0) { ClientHandlerThread t = clientThreads_.First.Value; clientThreads_.RemoveFirst(); t.Shutdown("reactor is shutting down"); try { t.Join(); } catch (System.Exception e) { t.Log("Error shutting down: " + e.Message); } } state_ = State.SHUTDOWN_COMPLETE; } } }