From: Paolo Bonzini <pbonzini@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
Anthony Liguori <aliguori@amazon.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] curses: fixup SIGWINCH handler mess
Date: Tue, 12 Nov 2013 13:16:41 +0100 [thread overview]
Message-ID: <52821C29.5020005@redhat.com> (raw)
In-Reply-To: <528216C7.10705@redhat.com>
Il 12/11/2013 12:53, Laszlo Ersek ha scritto:
> Also, I grepped the source for SIGWINCH, and I think it is never masked
> with pthread_sigmask(), or -- while the process is single-threaded
> initially -- with sigprocmask(). Hence this signal can be delivered at
> any time and interrupt interruptible functions (which is good
> justification for the patch.) My point though is that after this patch a
> narrow window seems to exist where you can lose a signal, namely between
> checking "got_sigwinch" and resetting it.
You don't really lose it, it is delayed to the next refresh.
> (SIGWINCH is not a standard signal but I do think it it's not a realtime
> one, hence it doesn't queue up; it can only be pending or not.)
Indeed.
> For ultimate pedantry we could maybe write
>
> bool local;
>
> /* block the signal with pthread_sigmask()
> * for atomic retrieval and reset
> */
> local = got_sigwinch;
> got_sigwinch = false;
> /* unblock the signal */
>
> if (!local) {
> return;
> }
>
> but it's likely overkill.
Or just use an atomic function:
if (!atomic_xchg(&got_sigwinch, false)) {
return;
}
Paolo
prev parent reply other threads:[~2013-11-12 12:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 8:43 [Qemu-devel] [PATCH] curses: fixup SIGWINCH handler mess Gerd Hoffmann
2013-11-12 11:53 ` Laszlo Ersek
2013-11-12 12:16 ` Gerd Hoffmann
2013-11-12 12:32 ` Laszlo Ersek
2013-11-12 12:16 ` Paolo Bonzini [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=52821C29.5020005@redhat.com \
--to=pbonzini@redhat.com \
--cc=aliguori@amazon.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 NNTP newsgroup(s).