diff options
-rw-r--r-- | include/salticidae/conn.h | 7 | ||||
-rw-r--r-- | include/salticidae/event.h | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/include/salticidae/conn.h b/include/salticidae/conn.h index 79b1a89..2dab517 100644 --- a/include/salticidae/conn.h +++ b/include/salticidae/conn.h @@ -345,11 +345,14 @@ class ConnPool { if (!worker_running) return; worker_running = false; SALTICIDAE_LOG_INFO("stopping all threads..."); + /* stop the dispatcher */ + workers[0].stop(); + workers[0].get_handle().join(); /* stop all workers */ - for (size_t i = 0; i < nworker; i++) + for (size_t i = 1; i < nworker; i++) workers[i].stop(); /* join all worker threads */ - for (size_t i = 0; i < nworker; i++) + for (size_t i = 1; i < nworker; i++) workers[i].get_handle().join(); } diff --git a/include/salticidae/event.h b/include/salticidae/event.h index d862ce8..4a1a410 100644 --- a/include/salticidae/event.h +++ b/include/salticidae/event.h @@ -256,6 +256,11 @@ class SigEvent { void add(int signum) { uv_signal_start(ev_sig, SigEvent::sig_then, signum); } + + void add_once(int signum) { + uv_signal_start_oneshot(ev_sig, SigEvent::sig_then, signum); + } + void del() { uv_signal_stop(ev_sig); } |