loop: improve in_thread handling of invoke queue

Because we now have a dedicated queue per thread, we can simply add our
invoke item to the queue and then flush all the queues when we are
running in the thread of the loop.

This simplifies some things and removes potential out-of-order messages
that got queued while flushing.
This commit is contained in:
Wim Taymans 2024-04-29 15:56:00 +02:00
parent de0db48f17
commit 8ff40e6252
2 changed files with 28 additions and 43 deletions

View file

@ -94,8 +94,7 @@ struct spa_loop_methods {
struct spa_source *source);
/** Invoke a function in the context of this loop.
* May be called from the loop's thread, but otherwise
* can only be called by a single thread at a time.
* May be called from any thread and multiple threads at the same time.
* If called from the loop's thread, all callbacks previously queued with
* invoke() will be run synchronously, which might cause unexpected
* reentrancy problems.