X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fthreads.h;h=3ec8c681aec1d60ffb6d6cba67fd2c6606a4ce3d;hb=refs%2Fheads%2F1.1-threads;hp=85aaced7ecc843f5cdf0b2c998660ab22a979139;hpb=6834b882015a9323672e9fce8811aa4283f196f0;p=tinc diff --git a/src/threads.h b/src/threads.h index 85aaced7..3ec8c681 100644 --- a/src/threads.h +++ b/src/threads.h @@ -29,7 +29,14 @@ typedef pthread_t thread_t; typedef pthread_mutex_t mutex_t; static inline bool thread_create(thread_t *tid, void (*func)(void *), void *arg) { - return !pthread_create(tid, NULL, (void *(*)(void *))func, arg); + bool result; + + sigset_t old, block; + sigfillset(&block); + pthread_sigmask(SIG_SETMASK, &block, &old); + result = pthread_create(tid, NULL, (void *(*)(void *))func, arg); + pthread_sigmask(SIG_SETMASK, &old, NULL); + return !result; } static inline void thread_destroy(thread_t *tid) { pthread_cancel(*tid);