public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Kaz Kylheku <920-082-4242@kylheku.com>
Cc: cygwin@cygwin.com
Subject: Re: Signal delivered while blocked
Date: Sat, 05 Aug 2017 06:40:00 -0000	[thread overview]
Message-ID: <20170805064013.GA3170154@rfd.leadboat.com> (raw)
In-Reply-To: <aa14e8b0af5a6808963604f2f263eaa1@mail.kylheku.com>

On Fri, Aug 04, 2017 at 11:58:51AM -0700, Kaz Kylheku wrote:
> On 04.08.2017 10:02, Corinna Vinschen wrote:
> >On Aug  4 00:44, Noah Misch wrote:
> >>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.
> >
> >Thanks for the testcase.  I debugged this a while today but the problem
> >is far from trivial, apparently.  Don't hold your breath for a quick
> >solution.

Understood.  Thanks for studying it.

> The test case depends on accesses to the global variable sigblocked not
> to be reordered w.r.t. siggprocmask calls.
> 
> It is important that the variable not be set to 1 until after the signals
> are
> blocked, and be reset to 0 until after they are unblocked.
> 
> Thus, the variable should be declared volatile.

Agreed, but ...

> Although I would be surprised if this were actually happening

... indeed, that didn't change the result.

> Also, related remarks: for the reason that we can't factor out compiler
> behavior, with absolute certainty, it would be good to mention not only
> the system versions but also GCC. The compiler differs, obviously,
> between Cygwin 1.7 and 2.7; not to mention that the case is reported
> against i686 of the one, and x86_74 of the other.

The Cygwin 2.7 system has gcc-core 5.4.0-1.  The unaffected Cygwin 1.7 system
has gcc-core 4.8.2-2.

--
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

  reply	other threads:[~2017-08-05  6:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04  7:45 Noah Misch
2017-08-04 17:02 ` Corinna Vinschen
2017-08-04 18:58   ` Kaz Kylheku
2017-08-05  6:40     ` Noah Misch [this message]
2017-08-14  6:03 ` Houder
2017-08-14  8:36   ` Signal delivered while blocked (2) Houder
2017-08-19  8:01   ` Signal delivered while blocked Noah Misch
2017-08-20 12:18     ` Houder
2017-08-20 16:16       ` Noah Misch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170805064013.GA3170154@rfd.leadboat.com \
    --to=noah@leadboat.com \
    --cc=920-082-4242@kylheku.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).