X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Eric Blake Subject: Re: Cygwin speed Date: Wed, 7 Mar 2007 21:25:48 +0000 (UTC) Lines: 34 Message-ID: References: <45E86FFD DOT 7060301 AT princeton DOT edu> <45E876FA DOT 7401B017 AT dessent DOT net> <20070305011713 DOT GG6734 AT ns1 DOT anodized DOT com> <45EF1CED DOT 608 AT t-online DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Christian Franke 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/