Re: blocking call in pulse core mainloop context results in sink not getting data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 3 Sep 2021, at 6:24 AM, Ravikiran belur wrote:
> Thanks Arun.
> 
> I looked at the fix below for a similar mainloop blocking issue.
> https://lists.freedesktop.org/archives/pulseaudio-discuss/2013-May/017283.html
> 
> I wanted to make use of threaded mainloop for blocking operations like 
> below, so that the core mainloop is not blocked.
> Please suggest if this is possible.
> 
> /* Runs in PA core mainloop context */
> static void pa_core_api (pa_mainloop_api *api, void *userdata) {
> > /* call PA core APIs here*/
> }
> 
> /* Runs in local threaded mainloop context */
> static void blocking_func(pa_mainloop_api *api, void *userdata) {
> > /* make blocking operations here */
> > pa_mainloop_api_once(*core->mainloop*, pa_core_api, userdata); /* execute pa_core_api() in PA core mainloop context */ 
> }
> 
> /* Runs in PA core mainloop context */
> static void hook_callback() {
> > pa_threaded_mainloop_lock(u->threaded_mainloop);
> > pa_mainloop_api_once(*u->threaded_mainloop_api*, blocking_func, userdata); /* execute blocking_func() in threaded_mainloop context */ 
> > pa_threaded_mainloop_unlock(u->threaded_mainloop);
> }

You could do this, or just start up a thread and use a message queue using some of the utility functions we have (pa_thread_new() and pa_thread_mq).

-- Arun



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux