diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-26 22:20:10 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-26 22:20:10 +0100 |
| commit | a852c1761489105a6e6acfdf324646854c72fdab (patch) | |
| tree | 8dc5f763196cb89e48557de7af27d0c18dba1069 | |
| parent | b33bf3f7042464ac4f6e187fc487ee42668fcef7 (diff) | |
Don't permit any signal delivery to threads on Linux
| -rw-r--r-- | src/threading.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/threading.cpp b/src/threading.cpp index 61f9df2db..8e1ee8104 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -356,7 +356,12 @@ void gb__thread_run(Thread *t) { return 0; } #else - void * internal_thread_proc(void *arg) { + void *internal_thread_proc(void *arg) { + // NOTE: Don't permit any signal delivery to threads. + sigset_t mask = {}; + sigfillset(&mask); + GB_ASSERT_MSG(pthread_sigmask(SIG_BLOCK, &mask, nullptr) == 0, "failed to block signals"); + Thread *t = cast(Thread *)arg; gb__thread_run(t); t->is_running.store(false); |