[pulseaudio-discuss] Threaded loops and theoretical deadlock in reference implementation (and lots of code).

Colin Guthrie gmane at colin.guthr.ie
Sat Feb 28 18:27:35 PST 2009


Hi,

I was trying to debug a deadlock while using gvim (with 
libcanberra+pulse output: https://qa.mandriva.com/show_bug.cgi?id=44925) 
I had reason to read the threaded loop docs.

The reference implementation shown here:
http://0pointer.de/lennart/projects/pulseaudio/doxygen/threaded_mainloop.html#basic_subsec

In my mind, the operation could theoretically be cancelled and this the 
_get_state() will return PA_OPERATION_CANCELLED.

In the example code, if this happens, the loop will spin and the main 
loop will never be unlocked.

This could be fixed by spinning when the state is PA_OPERATION_RUNNING 
rather when it is not PA_OPERATION_DONE (incidentally, there is a typo 
in the docs... it says OPERATION_RUNNING without the PA_ prefix...).

Anyway, any comments on this observation would be appreciated.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list