[PATCH] winegstreamer: Check the callback list before waiting.
Some callbacks may be pushed during pipeline initialization and before the dispatch thread is actually started and waiting for them, which sometimes causes some hangs. This fixes Fallout 3 and Panzer Corps -and possibly others- intro videos hanging forever. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/winegstreamer/gst_cbs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dlls/winegstreamer/gst_cbs.c b/dlls/winegstreamer/gst_cbs.c index a0618798d895..bf7103b1606b 100644 --- a/dlls/winegstreamer/gst_cbs.c +++ b/dlls/winegstreamer/gst_cbs.c @@ -66,15 +66,11 @@ static DWORD WINAPI dispatch_thread(void *user) while (1) { - pthread_cond_wait(&cb_list_cond, &cb_list_lock); + while (list_empty(&cb_list)) pthread_cond_wait(&cb_list_cond, &cb_list_lock); - while (!list_empty(&cb_list)) - { - cbdata = LIST_ENTRY(list_head(&cb_list), struct cb_data, entry); - list_remove(&cbdata->entry); - - TrySubmitThreadpoolCallback(&perform_cb, cbdata, NULL); - } + cbdata = LIST_ENTRY(list_head(&cb_list), struct cb_data, entry); + list_remove(&cbdata->entry); + TrySubmitThreadpoolCallback(&perform_cb, cbdata, NULL); } pthread_mutex_unlock(&cb_list_lock); -- 2.26.0.rc2
participants (2)
-
Rémi Bernon -
Zebediah Figura