<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:14pt"><div>Hi Tanu,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Also which thread does all of the hooks (PA_COE_HOOK_SINK_INPUT_PUT, and so on) run in?</div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">My understanding is that within the PA daemon process, PA daemon has a mainloop (which is a thread), and IO threads within the sinks or sources. Are there threads corresponding to each of the client applications (paplayer
and so on)?</div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Thank you every much.</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Tony</div> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 14pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Tong Wu <w_tong2000@yahoo.com><br> <b><span style="font-weight: bold;">To:</span></b> Tanu Kaskinen
<tanuk@iki.fi> <br><b><span style="font-weight: bold;">Cc:</span></b> "pulseaudio-discuss@lists.freedesktop.org" <pulseaudio-discuss@lists.freedesktop.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, February 20, 2013 4:46 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [pulseaudio-discuss] thread safe of idxset<br> </font> </div> <br>
<div id="yiv979382102"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 14pt;"><div><span>I see that for instance in function apply_cork_to_sink() in module-role-cork.c, there is a loop over all sink_inputs of a sink via idxset. What about a sink_input disappears during that loop?</span></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>Is apply_cork_to_sink() running in the PA daemon's mainloop? And all sink_input's come and go only happen in the PA daemon's mainloop as well?</span></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 19px;
font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>Many thanks.</span></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 19px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>Tony </span></div><div><br></div> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 14pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Tanu Kaskinen <tanuk@iki.fi><br> <b><span style="font-weight:bold;">To:</span></b> Tong Wu <w_tong2000@yahoo.com> <br><b><span
style="font-weight:bold;">Cc:</span></b>
"pulseaudio-discuss@lists.freedesktop.org" <pulseaudio-discuss@lists.freedesktop.org> <br> <b><span style="font-weight:bold;">Sent:</span></b> Wednesday, February 20, 2013 2:58 PM<br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [pulseaudio-discuss] thread safe of idxset<br> </font> </div> <br>
On Wed, 2013-02-20 at 14:52 -0800, Tong Wu wrote:<br>> Is the loop over sink-input idxset of a sink thread safe? For<br>> instance, when a sink-input disappears due to the end of playback, and<br>> at the same time I am trying to loop over the related idxset hoding<br>> the sink-input?<br><br>pa_idxset is not thread safe. What code are you working on?<br><br>-- <br>Tanu<br><br><br><br> </div> </div> </div></div></div><br><br> </div> </div> </div></body></html>