gstpoll: retry reading the control socket to release properly all wakeups

if set->control_pending is set to 0 but we didn't not succed reading
the control socket, future calls to gst_poll_wait() will be awaiken
by the control socket which will not be released properly because
set->control_pending is already 0, causing an infinite loop.
This commit is contained in:
Andoni Morales Alastruey 2011-04-04 03:33:46 +02:00 committed by Wim Taymans
parent eba33c1de1
commit 7c6d9c2725

View file

@ -210,8 +210,11 @@ release_all_wakeup (GstPoll * set)
/* try to remove all pending control messages */
if (g_atomic_int_compare_and_exchange (&set->control_pending, old, 0)) {
/* we managed to remove all messages, read the control socket */
(void) RELEASE_EVENT (set);
break;
if (RELEASE_EVENT (set))
break;
else
/* retry again until we read it successfully */
g_atomic_int_exchange_and_add (&set->control_pending, 1);
}
}
return old;