From a6796aa623b2c34d7f680a5ccae74ec893f16d36 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 18 Nov 2018 18:19:56 -0500 Subject: ... --- include/salticidae/conn.h | 7 +++++-- 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); } -- cgit v1.2.3-70-g09d2