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@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Rémi Bernon 2020-03-26 00:03:18 +01:00 committed by Alexandre Julliard
parent 032d848ac4
commit b3a33f065d
1 changed files with 4 additions and 8 deletions

View File

@ -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);