From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Kenton Varda <kenton@cloudflare.com>
Cc: cygwin@cygwin.com
Subject: Re: sigpending() incorrectly returns signals pending on other threads
Date: Fri, 12 Jul 2019 15:31:00 -0000 [thread overview]
Message-ID: <20190712153128.GG3772@calimero.vinschen.de> (raw)
In-Reply-To: <CAJouXQne09R+j+k+ZNw5fsZTFqDG5_9iwm9KQnxHoycL+ap_KQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
On Jul 6 15:46, Kenton Varda wrote:
> Hello Cygwin,
>
> According to the (Linux) man page: "sigpending() returns the set of
> signals that are pending for delivery to the calling thread"
>
> However, on Cygwin, sigpending() seems to return the set of signals
> pending on any thread, as shown in the attached test program.
>
> Among other things, this can cause deadlocks in programs which use
> sigpending() to check for pending signals, then use sigsuspend() to
> induce delivery of the specific signals that are pending. Because the
> signal is not actually pending on the current thread, sigsuspend()
> will unexpectedly block, potentially forever.
>
> Output of test program:
> $ uname -srv
> CYGWIN_NT-6.1 3.0.7(0.338/5/3) 2019-04-30 18:08
> $ gcc -std=c11 -Wall test-sigpending.c -o test-sigpending -pthread &&
> ./test-sigpending
> sending signal to child thread with pthread_kill()...
> sigpending() says signal is pending in main thread (WRONG)
> sigpending() says signal is pending in child thread (CORRECT)
> received signal in child thread (CORRECT)
Thanks for the testcase. This should work now in current git master.
I uploaded new developer snapshots to https://cygwin.com/snapshots/
Please give them a try.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-07-12 15:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-06 22:46 Kenton Varda
2019-07-07 2:16 ` Kenton Varda
2019-07-12 15:34 ` Corinna Vinschen
2019-07-14 13:19 ` Houder
2019-07-15 7:53 ` Corinna Vinschen
2019-07-15 9:54 ` Houder
2019-07-12 15:31 ` Corinna Vinschen [this message]
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=20190712153128.GG3772@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
--cc=kenton@cloudflare.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).