[pulseaudio-discuss] thread safe of idxset

Tanu Kaskinen tanuk at iki.fi
Thu Feb 21 01:01:20 PST 2013


On Wed, 2013-02-20 at 16:57 -0800, Tong Wu wrote:
> Hi Tanu,
> 
> Also which thread does all of the hooks (PA_COE_HOOK_SINK_INPUT_PUT,
> and so on) run in?

The PA_CORE_HOOK_* hooks are always run from the main thread.

> 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)?

There are no separate threads for clients.

> 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?
> 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?

Yes, module-role-cork operates solely in the main thread, and it should
not touch anything that can be changed from other threads. Sink inputs
can only be removed from the main thread.

-- 
Tanu



More information about the pulseaudio-discuss mailing list