mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
Revert "loop: don't call the hooks around blocking wait"
This reverts commit 46dfa69f26.
We do actually need to release the locks for now. The reason is that
pipewire core will at various points do a blocking invoke into the
thread-loop (which is the data-loop when using non-rt/async processing)
to synchronize state. Because these functions are called with the
thread-loop lock and from some other thread (like gstreamer) it causes
a deadlock because the thread-loop is locked and can't run and the
caller is waiting for the thread-loop to complete.
See #4472
This commit is contained in:
parent
ff60e68a23
commit
060d0e1761
2 changed files with 9 additions and 5 deletions
|
|
@ -119,11 +119,11 @@ struct spa_loop_methods {
|
||||||
* an object that has identity.
|
* an object that has identity.
|
||||||
* \param size The size of data to copy.
|
* \param size The size of data to copy.
|
||||||
* \param block If \true, do not return until func has been called. Otherwise,
|
* \param block If \true, do not return until func has been called. Otherwise,
|
||||||
* returns immediately. Passing \true can cause a deadlock when
|
* returns immediately. Passing \true does not risk a deadlock because
|
||||||
* the calling thread is holding the loop context lock. A blocking
|
* the data thread is never allowed to wait on any other thread.
|
||||||
* invoke should never be done from a realtime thread. Also beware
|
* It the loop requires some locking, it must be acquired before
|
||||||
* of blocking invokes between 2 threads as you can easily end up
|
* calling this function because a blocking invoke will release
|
||||||
* in a deadly embrace.
|
* the lock while blocking.
|
||||||
* \param user_data An opaque pointer passed to func.
|
* \param user_data An opaque pointer passed to func.
|
||||||
* \return `-EPIPE` if the internal ring buffer filled up,
|
* \return `-EPIPE` if the internal ring buffer filled up,
|
||||||
* if block is \false, 0 if seq was SPA_ID_INVALID or
|
* if block is \false, 0 if seq was SPA_ID_INVALID or
|
||||||
|
|
|
||||||
|
|
@ -472,10 +472,14 @@ again:
|
||||||
if (block && queue->ack_fd != -1) {
|
if (block && queue->ack_fd != -1) {
|
||||||
uint64_t count = 1;
|
uint64_t count = 1;
|
||||||
|
|
||||||
|
spa_loop_control_hook_before(&impl->hooks_list);
|
||||||
|
|
||||||
if ((res = spa_system_eventfd_read(impl->system, queue->ack_fd, &count)) < 0)
|
if ((res = spa_system_eventfd_read(impl->system, queue->ack_fd, &count)) < 0)
|
||||||
spa_log_warn(impl->log, "%p: failed to read event fd:%d: %s",
|
spa_log_warn(impl->log, "%p: failed to read event fd:%d: %s",
|
||||||
queue, queue->ack_fd, spa_strerror(res));
|
queue, queue->ack_fd, spa_strerror(res));
|
||||||
|
|
||||||
|
spa_loop_control_hook_after(&impl->hooks_list);
|
||||||
|
|
||||||
res = item->res;
|
res = item->res;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue