public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Jon Beniston" <jon@beniston.com>
To: <cygwin@cygwin.com>
Subject: RE: SIGINT lost while program calls PeekMessage
Date: Mon, 6 Jul 2020 14:16:06 +0100	[thread overview]
Message-ID: <02c901d65397$9c49fcf0$d4ddf6d0$@beniston.com> (raw)
In-Reply-To: 

Hi Corinna,

>Since your example code is running very tightly most of its time inside
>some Windows system DLL function, there's next to no chance to interrupt
>the thread to inject the signal handler call.  Cygwin tries this 100
>times per signal.  If that fails, the signal gets lost.
>
>One way to solve this problem is adding a Cygwin call into the loop,
>like the aforementioned usleep.  When a Cygwin call is performed, the
>signal handler will be called as soon as the Cygwin call returns to
>user-space.
>
>The bottom line is, Cygwin user space signal handlers and lots of
>Windows-only calls in a tight loop don't work nicely together.

Ok, thanks for the explanation. In the real application, there is some
actual processing inside the loop, besides the call to PeekMessage and more
signals get through (Probably 75%), I just cut the code down to make a
simpler test case. I'll add a Cygwin call as suggested.

Cheers,
Jon


             reply	other threads:[~2020-07-06 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 13:16 Jon Beniston [this message]
2020-07-06 18:21 ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2020-07-02 16:16 Jon Beniston
2020-07-03 19:22 ` Corinna Vinschen

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='02c901d65397$9c49fcf0$d4ddf6d0$@beniston.com' \
    --to=jon@beniston.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).