Christian Franke <Christian.Franke <at> t-online.de> writes: > Cygwin's sigprocmask() unconditionally calls sig_dispatch_pending(). > This is necessary because POSIX requires that at least one pending > signal is dispatched by sigprocmask().
Actually, POSIX requires "If there are any pending unblocked signals after the call to sigprocmask(), at least one of those signals shall be delivered before the call to sigprocmask() returns." And the way I see it, if the mask is unchanged, then any signal that was unblocked before calling sigprocmask() should have already fired. In other words, the only signals that sigprocmask() HAS to worry about are signals that just changed to unmasked; and if the mask isn't changing, then there is no need to flush the signal queue. > > With the attached patch, sigprocmask() does nothing if the signal mask > is not changed. > This reduces the context switches to <5000. > (Patch is only intended for testing, it at least breaks above POSIX rule) I think your patch is still within the spirit of POSIX - I don't see the rule being broken. I'll defer to cgf's judgment on this; but it sounds like a worthwhile patch to apply, even if it doesn't help the common case of non- builtins. And if cgf decides not to patch cygwin in this manner, I can at least try to patch bash to not call sigprocmask() if it knows the mask is not changing. -- Eric Blake volunteer cygwin bash maintainer -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/