diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-08-02 23:34:10 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-08-02 23:34:10 +0200 |
commit | 0e31829401c78c36a8e473091644c12d04742370 (patch) | |
tree | 3242a810ed3a6610f094c520f920fe541b3288f9 | |
parent | d9f304e4b074cf7c918fc434f04fe82da98b43a3 (diff) |
nDPId-test: threads should block all unix signals
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | nDPId-test.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/nDPId-test.c b/nDPId-test.c index 836d0b347..8e8870a8a 100644 --- a/nDPId-test.c +++ b/nDPId-test.c @@ -241,6 +241,14 @@ static int thread_wait(struct thread_condition * const tc) return ret; } +static int thread_block_signals() +{ + sigset_t blocked_signals; + + sigfillset(&blocked_signals); + return pthread_sigmask(SIG_BLOCK, &blocked_signals, NULL); +} + static int thread_signal(struct thread_condition * const tc) { int ret = 0; @@ -294,6 +302,11 @@ static void * nDPIsrvd_mainloop_thread(void * const arg) logger(0, "nDPIsrvd thread started, init.."); + if (thread_block_signals() != 0) + { + logger(1, "nDPIsrvd block signals failed: %s", strerror(errno)); + } + errno = 0; epollfd = create_evq(); if (epollfd < 0) @@ -857,6 +870,11 @@ static void * distributor_client_mainloop_thread(void * const arg) logger(0, "Distributor thread started, init.."); + if (thread_block_signals() != 0) + { + logger(1, "Distributor block signals failed: %s", strerror(errno)); + } + errno = 0; if (mock_sock == NULL || mock_buff == NULL || mock_null == NULL) { @@ -1170,6 +1188,11 @@ static void * nDPId_mainloop_thread(void * const arg) logger(0, "nDPId thread started, init.."); + if (thread_block_signals() != 0) + { + logger(1, "nDPId block signals failed: %s", strerror(errno)); + } + if (setup_reader_threads() != 0) { THREAD_ERROR(trr); |