Reputation: 4249
Are there any well known reasons for sigprocmask() to segfault when used in a multithreaded application?
I have an application that creates multiple threads using clone(). I have determined that for some reason when I use sigprocmask it segfaults (not all the time though). From the backtrace() it also seems like the segfault is occuring when I use sigprocmask() after a siglongjmp().
Any ideas?
Upvotes: 3
Views: 653
Reputation: 60853
Check the second and third arguments. If they are not NULL, ensure that they are each a valid pointer to a sigset_t
.
Note that sigprocmask()
is only officially defined for a single-threaded process. A multithreaded process should use pthread_sigmask()
instead, which takes the same arguments although it returns the error code rather than using errno
.
Upvotes: 1