From: Paolo Bonzini <pbonzini@redhat.com>
To: Alon Levy <alevy@redhat.com>, qemu list <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] ccid-card-emulated: use EventNotifier
Date: Mon, 23 Jun 2014 13:07:10 +0200 [thread overview]
Message-ID: <53A80A5E.7080302@redhat.com> (raw)
In-Reply-To: <1018003733.41131057.1403519938991.JavaMail.zimbra@redhat.com>
Il 23/06/2014 12:38, Alon Levy ha scritto:
>> > {
>> > - EmulatedState *card = opaque;
>> > + EmulatedState *card = container_of(notifier, EmulatedState, notifier);
>> > EmulEvent *event, *next;
>> > - char dummy;
>> > - int len;
>> >
>> > - do {
>> > - len = read(card->pipe[0], &dummy, sizeof(dummy));
>> > - } while (len == sizeof(dummy));
>> > + event_notifier_test_and_clear(&card->notifier);
> Shouldn't the ignored return value be marked somehow?
It's a pretty common idiom to test-and-clear the event notifier. Really
hot paths have a while() loop, but for ccid-card-emulated it's simpler
to just go through the main loop again. In fact, it was just what the
pipe-based code used to do. :)
Paolo
prev parent reply other threads:[~2014-06-23 11:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 10:30 [Qemu-devel] [PATCH] ccid-card-emulated: use EventNotifier Paolo Bonzini
2014-06-23 10:38 ` Alon Levy
2014-06-23 11:07 ` 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=53A80A5E.7080302@redhat.com \
--to=pbonzini@redhat.com \
--cc=alevy@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.