Signal handling tune up.

Christopher Faylor cgf@redhat.com
Fri Aug 29 15:54:00 GMT 2003


On Fri, Aug 29, 2003 at 10:18:17AM -0400, Pierre A. Humblet wrote:
>Christopher Faylor wrote:
>>Do you think that an occasional loop through the signal handler is
>>slowing things down that much?  Do you think that sig_dispatch_pending
>>gets called a lot with all pending signals blocked?  Are you convinced
>>that you can set a mask in a non-raceable way?
>
>Yes in heavy traffic, and it contributes the the trashing phenomenon I
>saw with SIGALRM (system has to work even more in heavy load).
>
>Races in sig_dispatch_pending() could occur because either a) the mask
>changes, or because b) pending_signal_mask changes.  a) isn't a problem
>in the long run because with pthreads a mask can only be changed by its
>thread (there is no process mask).

Aren't you talking about having wait_sig build up a mask of pending
signals as it iterates through the list?  That sounds like a potential for
a big race condition to me.

In any event, I have just found an interesting paper by Ulrich Drepper
which talks about not using an actual mask for signals but using an array
instead.  I'm still mulling over if that is something I want to change
or not.

>I am also starting to look at the relation with pthread and signals.

i.e., it doesn't work at all.  That is a known problem.  Please don't
waste your time trying to fix this.  I have many ideas on how to fix
this and have the seeds of some code in cygwin already.

>I noticed that sigactions are currently per thread, which isn't Posix. 
>An immediate fix is to change "getsig (int sig)" in pinfo.h, you will
>need to touch it anyway when you pull the sigactions out of pinfo.

On looking at this further, I won't be able to do this (at least
trivially) since there are parts of cygwin which rely on being able
to have processes inspect this info.

cgf



More information about the Cygwin-patches mailing list