Skip to contentSkip to conversation

eventfd_signal()

Qemu-devel Catalin Vasile 2 participants 3 messages May 8, 2015

lore
Share & tools
lore
#0 lore raw

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?

#1 lore raw
Quoted 3 lines · Catalin Vasile

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

#2 lore raw
Quoted 13 lines · Paolo Bonzini
Quoted 3 lines · Catalin Vasile

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);
Quoted 5 lines

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