Linux: Question on sigprocmask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This is a problem on signal handling.  I have an multi-threaded application
which works find on AIX but am facing problems on Linux.   I was browsing
though the web and thought this might be the right place to ask the
question.
Could you please advice ?

I am executing a semop call in a function which is called from a signal
handler.  Since semop call returns an error code of EINTR when it is
interrupted by a signal, i need to mask the signals at the starting of this
function and unmask it at the end of the function.

On Aix i use sigthreadmask to block the signals in the thread which calls
this function and everything works fine.

On Linux since there is no sigthreadmask, i have to use either
pthread_sigmask and sigprocmask.

If i use pthread_sigmask, it masks the signals for the current thread.  so
if i issue a kill -2 to this process, the semop call doesn't fail.  However
if  i issue 2 signals at a time (kill -3 <pid> ; kill -2 <pid>) the semop
call fails ( the reason i feel is that some other thread which is not
masking this signal gets it) (since threads implementation on linux is
different than aix).

This problem doesn't get solved even if i use sigprocmask.  I am using
Red Hat Linux release 7.2 (Enigma)
Kernel 2.4.7-10 on an i686

Is sigprocmask not working as designed ?  Is there any other call which can
be used ?  Any other suggestions ?



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux