mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
thread-loop: only signal when option is set
Add a thead-loop.start-signal option that will do a signal before entering the thread loop. Doing the signal in all cases can confuse apps that don't expect the signal. Make module-rt use the thread-loop.start-signal. Fixes #3374
This commit is contained in:
parent
55812195ce
commit
920bb7160e
2 changed files with 13 additions and 2 deletions
|
|
@ -1085,10 +1085,14 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
#ifdef HAVE_DBUS
|
||||
impl->use_rtkit = use_rtkit;
|
||||
if (impl->use_rtkit) {
|
||||
struct spa_dict_item items[] = {
|
||||
{ "thread-loop.start-signal", "true" }
|
||||
};
|
||||
if ((res = rtkit_get_bus(impl)) < 0)
|
||||
goto error;
|
||||
|
||||
impl->thread_loop = pw_thread_loop_new("module-rt", NULL);
|
||||
impl->thread_loop = pw_thread_loop_new("module-rt",
|
||||
&SPA_DICT_INIT_ARRAY(items));
|
||||
if (impl->thread_loop == NULL) {
|
||||
res = -errno;
|
||||
goto error;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ struct pw_thread_loop {
|
|||
int n_waiting_for_accept;
|
||||
unsigned int created:1;
|
||||
unsigned int running:1;
|
||||
unsigned int start_signal:1;
|
||||
};
|
||||
/** \endcond */
|
||||
|
||||
|
|
@ -143,6 +144,11 @@ static struct pw_thread_loop *loop_new(struct pw_loop *loop,
|
|||
return NULL;
|
||||
|
||||
pw_log_debug("%p: new name:%s", this, name);
|
||||
if (props != NULL) {
|
||||
const char *str = spa_dict_lookup(props, "thread-loop.start-signal");
|
||||
if (str != NULL)
|
||||
this->start_signal = spa_atob(str);
|
||||
}
|
||||
|
||||
if (loop == NULL) {
|
||||
loop = pw_loop_new(props);
|
||||
|
|
@ -282,6 +288,7 @@ static void *do_loop(void *user_data)
|
|||
pw_log_debug("%p: enter thread", this);
|
||||
pw_loop_enter(this->loop);
|
||||
|
||||
if (this->start_signal)
|
||||
pw_thread_loop_signal(this, false);
|
||||
|
||||
while (this->running) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue