X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:from:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=pG6U2kQXUIQ27vA5K RApGpjTpEQi+69XHsWM+E5Vh26H1Eayktv4gqr4bL5A9N9hk4dIcUJN+QJQ3rEt/ NBGfEUSSMF01FRAibbRNIDt1ZLWT77vpqra4fFtQmua+nPNTGUzL65rcam6JnGVk MEzNpzUDY9TFMByMKxCHqZJzfc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:from:to:subject:references :in-reply-to:content-type; s=default; bh=Qsdt/g1IwbnUOPrF92qYVY6 0uqs=; b=FcRQrZRz8QIYdtSbfriLxHTjG6TxQkVwyaOSLDZDONUD+uSQqcczyQk aTf3oxXV4VSuT34q8BASOSJOoZ8SbApsKgQR6ywECtl0hrYsLpZCgPZH0L8KsNDH U30y/lqkDKcO0skdBILIcSWgmDshK8D63w6cuk1S2l34so6Omf9k= 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Blocking, henri, exhibits, receipt X-HELO: lb1-smtp-cloud7.xs4all.net Date: Mon, 14 Aug 2017 08:03:07 +0200 Message-ID: <8f7f7f8ae098c1321f608645c750cae4@smtp-cloud7.xs4all.net> From: Houder To: cygwin AT cygwin DOT com Subject: Re: Signal delivered while blocked References: <20170804074445 DOT GB3154757 AT rfd DOT leadboat DOT com> In-Reply-to: <20170804074445.GB3154757@rfd.leadboat.com> Content-Type: text/plain; charset=UTF-8; format=fixed User-Agent: mua.awk 0.99 X-CMAE-Envelope: MS4wfMwT6/DsR4cHxdR21AbUhniarKZu8Ags+HbelIDl2dST66j4RR3+4DdAUlNYZDtkMuyw+vwp72P7PyydWVy/tF5Ax/WY9QAf3zffmabNnQxDxTyxX6ao OSJ0/WuLpc+uji72b6avkmxJpneXPE18mI9pKheTPbBp7LMX+UxP0VG2znYo+Au0DprdCeVj623dFg== On Fri, 4 Aug 2017 00:44:45, Noah Misch wrote: > --UugvWAfsgieZRqgk > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > > The attached demonstration program blocks signals (with sigprocmask()) to > achieve mutual exclusion between signal handlers. It aborts upon receipt of a > blocked signal. On "CYGWIN_NT-10.0 2.7.0(0.306/5/3) 2017-02-12 13:18 x86_64", > signals regularly arrive despite being blocked. Essential parts of the > program include handling two signal numbers and having handlers run for at > least 1-2ms; this problem goes away if I remove one of those attributes. > GNU/Linux, AIX, Solaris, and "CYGWIN_NT-6.0 1.7.27(0.271/5/3) 2013-12-09 11:57 > i686" never deliver a blocked signal to this program. I think this Cygwin > behavior is non-conforming. Hi Noah, I do not think that Cygwin is the problem here; your code is the problem here, I believe. Please, study, for example, chapters 20 and 21 of LPI (Linux Programming Interface by Michael Kerrisk). (20.10 The Signal Mask (Blocking Signal Delivery) (20.13 Changing Signal Dispositions: sigaction()) You cannot use sigprocmask() like you do; you cannot use SIG_SETMASK as a parameter in sigprocmask() within the context of a handler. Cygwin exhibits misbehaviour in case of your code, because it is slower than Linux; however, the code is also wrong for Linux. The misbehaviour occurs as result of nested interrupts in case of your code (yes, nested interrupts are possible with Linux/Unix!). However your code does not experience nesting under Linux, because, as I said, Linux is faster than Cygwin. ----- The simplest way to exclude one signal from another, is to specify the signal (or signals) in the sa_mask of the sigaction parameter ... see sigaction() ----- However if you desire 'control' during the execution of a handler, you have to resort to sigprocmask(), and use SIG_BLOCK and SIG_UNBLOCK, in order to add and remove a specific signal to/from the mask. see sigprocmask() You cannot use SIG_SETMASK in that context. Regards, Henri ===== -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple