Hello,

I am reading GNU C library manual.

    24.7.2 Signal Sets:
    https://www.gnu.org/software/libc/manual/html_node/Signal-Sets.html

All functions have MT-Safe | AS-Safe | AC-Safe attributes.

So, I wonder what your problem is, and what you are suggesting.

> This code is not properly reentrant, but it can be reentered if
> another one of the trapped signals occurs

I think that there is no problem that another signal occurs when
_sigev_handler is called, provided the sigaddset function is safe.
(1) Different signals are recorded properly in sigev_pending.
(2) When they are same signal (two or occurrences), it is marked
properly as occurred.  (Signal handling should be done with the
assumption that it might be multiple occurrences.)

Reading the __sigaddset implementation:

    
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/sigset.h;hb=b040e1b0842c35ab444e8502db6ae59389d1e3d5#l117

For me, it is not clear if it can be done atomically.  If the bit
handling is not atomic, I think that it's not MT-Safe.  But, this is the
issue of C library.

Well, npth_sigev_get_pending should be used by a single thread (with the
current nPth implementation); Or else, there is a race between
sigismember and sigdel call.  An event of signal (that might be multiple
signals of SIGNUM) can be handled multiple times by different threads.
-- 

Reply via email to