On Sat, 13 Dec 2025 00:56:39 +0000 (UTC) RVP <[email protected]> wrote: > Hmm. In FreeBSD, OpenBSD & Linux, pthread_sigmask(3) seems to apply > per-thread, > but on NetBSD, the whole process gets blocked--not just the thread which > called > pthread_sigmask():
I think your example may not be portable, you should really block those signals in main() since SIGINT is an asynchronous signal and can be delivered to any random thread which is not blocking it. If first blocked in main() all child threads created later will inherit the same signal mask with the blocked signal. On NetBSD it looks like SIGINT is delivered to sig_thread() while on other platforms it is delivered to main() which then terminates entire process. This is different with synchronous signals like SIGSEGV which are delivered to a specific thread that caused it.
