qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] eventfd_signal()
@ 2015-05-08 10:58 Catalin Vasile
  2015-05-08 11:24 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Catalin Vasile @ 2015-05-08 10:58 UTC (permalink / raw)
  To: qemu-devel

Is eventfd blocking? By that I mean: If I signal the guest for
something, will that thread remain blocked till the guest clears the
interrupt?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] eventfd_signal()
  2015-05-08 10:58 [Qemu-devel] eventfd_signal() Catalin Vasile
@ 2015-05-08 11:24 ` Paolo Bonzini
  2015-05-08 11:32   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2015-05-08 11:24 UTC (permalink / raw)
  To: Catalin Vasile, qemu-devel



On 08/05/2015 12:58, Catalin Vasile wrote:
> Is eventfd blocking? By that I mean: If I signal the guest for
> something, will that thread remain blocked till the guest clears the
> interrupt?

No.  If you want that, write 2^64-2 to the eventfd and do a

   pfd.fd = ...
   pfd.events = POLLOUT;
   poll(&pfd, 1, -1);

after the write.

With this algorithm, a write will fail with EINVAL if there is already
another pending write somewhere.  The "poll" will still work after the
failed write.

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] eventfd_signal()
  2015-05-08 11:24 ` Paolo Bonzini
@ 2015-05-08 11:32   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-05-08 11:32 UTC (permalink / raw)
  To: Catalin Vasile, qemu-devel



On 08/05/2015 13:24, Paolo Bonzini wrote:
> 
> 
> On 08/05/2015 12:58, Catalin Vasile wrote:
>> Is eventfd blocking? By that I mean: If I signal the guest for
>> something, will that thread remain blocked till the guest clears the
>> interrupt?
> 
> No.  If you want that, write 2^64-2 to the eventfd and do a
> 
>    pfd.fd = ...
>    pfd.events = POLLOUT;
>    poll(&pfd, 1, -1);
> 
> after the write.
> 
> With this algorithm, a write will fail with EINVAL if there is already
> another pending write somewhere.  The "poll" will still work after the
> failed write.

Oops, EAGAIN...

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-08 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-08 10:58 [Qemu-devel] eventfd_signal() Catalin Vasile
2015-05-08 11:24 ` Paolo Bonzini
2015-05-08 11:32   ` Paolo Bonzini

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).