mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
Don't use TSS to store per-thread queues but keep a lockfree stack of queues. We can then pick off a queue and write to that one and place it back after use. We need to keep the queues indexed by id in the stack because otherwise we would need to compare-and-swap 128 bits (pointer + tag), which is more problematic. Because we keep the queues in an array and no queue is ever removed and the array can only grow, we can quite easily just iterate the array without a lock. Without the lock we also fix one of the potential problems with ardour where the queue_flush thread is canceled while flushing and the queue_mutex remains locked. Because we end up with all queues in the array now, we can overflow the fixed max amount of queues we can manage. When that happens, sleep for a while and try again. This is a case where more than QUEUES_MAX (128) threads are invoking at the same time and is rather unlikely. There is also the queue overflow case which we now also must handle with a retry. This potentially uses more eventfds but again this should be unlikely and cause no further problems. See #4356 |
||
|---|---|---|
| .. | ||
| examples | ||
| include | ||
| include-private/spa-private | ||
| plugins | ||
| tests | ||
| tools | ||
| meson.build | ||