qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ccid-card-emulated: use EventNotifier


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] ccid-card-emulated: use EventNotifier
Date: Mon, 23 Jun 2014 13:07:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]