spa: some more invoke -> locked calls

This commit is contained in:
Wim Taymans 2025-03-10 17:46:28 +01:00
parent f7fdafc203
commit f2452a6af7
4 changed files with 17 additions and 17 deletions

View file

@ -85,6 +85,7 @@ struct impl {
struct spa_ratelimit rate_limit;
int retry_timeout;
bool prio_inherit;
union tag head;
@ -1371,9 +1372,6 @@ impl_init(const struct spa_handle_factory *factory,
SPA_VERSION_LOOP_UTILS,
&impl_loop_utils, impl);
CHECK(pthread_mutexattr_init(&attr), error_exit);
CHECK(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE), error_exit_free_attr);
impl->rate_limit.interval = 2 * SPA_NSEC_PER_SEC;
impl->rate_limit.burst = 1;
impl->retry_timeout = DEFAULT_RETRY;
@ -1383,13 +1381,15 @@ impl_init(const struct spa_handle_factory *factory,
impl->control.iface.cb.funcs = &impl_loop_control_cancel;
if ((str = spa_dict_lookup(info, "loop.retry-timeout")) != NULL)
impl->retry_timeout = atoi(str);
if ((str = spa_dict_lookup(info, "loop.prio-inherit")) != NULL &&
spa_atob(str)) {
CHECK(pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT),
error_exit_free_attr)
}
if ((str = spa_dict_lookup(info, "loop.prio-inherit")) != NULL)
impl->prio_inherit = spa_atob(str);
}
CHECK(pthread_mutexattr_init(&attr), error_exit);
CHECK(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE), error_exit_free_attr);
if (impl->prio_inherit)
CHECK(pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT),
error_exit_free_attr)
CHECK(pthread_mutex_init(&impl->lock, &attr), error_exit_free_attr);
pthread_mutexattr_destroy(&attr);

View file

@ -280,7 +280,7 @@ static int reassign_follower(struct impl *this)
if (following != this->following) {
spa_log_debug(this->log, "%p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_set_timers, 0, NULL, 0, this);
}
return 0;
}
@ -431,7 +431,7 @@ static int do_start(struct impl *this)
this->following = is_following(this);
this->started = true;
this->last_time = 0;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_set_timers, 0, NULL, 0, this);
return 0;
}
@ -440,7 +440,7 @@ static int do_stop(struct impl *this)
if (!this->started)
return 0;
this->started = false;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_set_timers, 0, NULL, 0, this);
return 0;
}
@ -573,7 +573,7 @@ static int impl_clear(struct spa_handle *handle)
this = (struct impl *) handle;
spa_loop_invoke(this->data_loop, do_remove_timer, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_remove_timer, 0, NULL, 0, this);
spa_system_close(this->data_system, this->timer_source.fd);
if (this->clock_fd != -1)

View file

@ -230,7 +230,7 @@ static int reassign_follower(struct impl *this)
if (following != this->following) {
spa_log_debug(this->log, "%p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_set_timers, 0, NULL, 0, this);
}
return 0;
}
@ -314,7 +314,7 @@ static int do_start(struct impl *this)
this->following = is_following(this);
this->started = true;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_set_timers, 0, NULL, 0, this);
return 0;
}
@ -323,7 +323,7 @@ static int do_stop(struct impl *this)
if (!this->started)
return 0;
this->started = false;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_set_timers, 0, NULL, 0, this);
return 0;
}
@ -847,7 +847,7 @@ static int impl_clear(struct spa_handle *handle)
this = (struct impl *) handle;
spa_loop_invoke(this->data_loop, do_remove_timer, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_remove_timer, 0, NULL, 0, this);
spa_system_close(this->data_system, this->timer_source.fd);
return 0;

View file

@ -1928,7 +1928,7 @@ static int spa_v4l2_stream_off(struct impl *this)
spa_log_debug(this->log, "stopping");
spa_loop_invoke(this->data_loop, do_remove_source, 0, NULL, 0, true, port);
spa_loop_locked(this->data_loop, do_remove_source, 0, NULL, 0, port);
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl(dev->fd, VIDIOC_STREAMOFF, &type) < 0) {