aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-11-18 18:19:56 -0500
committerDeterminant <[email protected]>2018-11-18 18:19:56 -0500
commita6796aa623b2c34d7f680a5ccae74ec893f16d36 (patch)
treec4e113243e2e76549ca9a17b2fe56df1a5e50fbd
parent499fcb776d691da06ec2da9a0fbadc3cbcf8758f (diff)
...
-rw-r--r--include/salticidae/conn.h7
-rw-r--r--include/salticidae/event.h5
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);
}