[pulseaudio-tickets] [PulseAudio] #738: Asynchonous changes to n_waiting_for_accept may be missed

PulseAudio trac-noreply at tango.0pointer.de
Wed Dec 2 07:58:55 PST 2009


#738: Asynchonous changes to n_waiting_for_accept may be missed
--------------------+-------------------------------------------------------
 Reporter:  Chris   |       Owner:  lennart 
     Type:  defect  |      Status:  new     
Milestone:          |   Component:  libpulse
 Keywords:          |  
--------------------+-------------------------------------------------------
 As seen here:
 http://git.0pointer.de/?p=pulseaudio.git;a=blob;f=src/pulse/thread-
 mainloop.c;h=a2b98ce1242e0304409d0fb601d6887d548427ca;hb=HEAD#l196
 pa_threaded_mainloop_signal with wait_for_accept=1 will wait on a mutex
 within a while loop that waits for m->n_waiting_for_accept to reach 0 from
 other threads decrementing it.

 However, compilers are allowed to optimize thinking that non-volatile
 variables will only be modified synchronously, so other threads modifying
 the value may be missed on the loop in question, leading to an infinite
 loop. I think the proper fix here is to mark n_waiting_for_accept (and
 n_waiting since it also works with asynchronous modifications) as
 volatile.

-- 
Ticket URL: <http://pulseaudio.org/ticket/738>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server


More information about the pulseaudio-bugs mailing list