Created attachment 86366 [details]
There's been a lot of fiddling with the mainloop's wakeup code since I wrote it. Unfortunately the current implementation is race-y and can send pa_poll() into a loop where it returns right away and the process starts eating 100% CPU.
What happens is:
1. pa_mainloop_wakeup() is called.
2. A wakeup byte is written on the pipe.
3. The atomic status variable is updated.
4. clear_wakeup() is called.
5. The atomic status variable is checked, and reset.
6. The pipe is read, but data has yet to propagate from the write end to the read end so we get nothing.
7. poll() is called, but returns quickly as there is now a byte sitting in the pipe.
8. clear_wakeup() is called, but won't read anything since the atomic status claims the pipe is empty.
9. goto 7.
The attached patch simply removes the extra variable. The pipe has atomic properties so it is quite sufficient by itself.
Thanks! Applied: http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=fe346cadedd2a9b48fc36886c4a8d48f50302f07