loop: spa_loop_invoke -> spa_loop_locked where possible

When we simply need to change some state for the code executed in the
loop, we can use locked() instead of invoke(). This is more efficient
and avoids some context switches in the normal case.
This commit is contained in:
Wim Taymans 2025-05-30 11:59:35 +02:00
parent b943c31fd8
commit c45d667934
29 changed files with 75 additions and 75 deletions

View file

@ -1135,7 +1135,7 @@ static int do_stop(struct impl *this)
spa_log_debug(this->log, "%p: stop", this);
spa_loop_invoke(this->data_loop, do_remove_source, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_remove_source, 0, NULL, 0, this);
this->started = false;
@ -1149,7 +1149,7 @@ static int do_release(struct impl *this)
spa_log_debug(this->log, "%p: release", this);
spa_loop_invoke(this->data_loop, do_remove_port_source, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_remove_port_source, 0, NULL, 0, this);
for (i = 0; i < N_PORTS; ++i) {
struct port *port = &this->ports[i];
@ -1260,7 +1260,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
if (this->started && 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_reassign_follower, 0, NULL, 0, true, this);
spa_loop_locked(this->data_loop, do_reassign_follower, 0, NULL, 0, this);
}
return 0;