poll: improve debugging

This commit is contained in:
Wim Taymans 2011-07-25 15:21:21 +02:00
parent ee235a6b07
commit d54f3f1385

View file

@ -179,6 +179,7 @@ raise_wakeup (GstPoll * set)
if (G_ATOMIC_INT_ADD (&set->control_pending, 1) == 0) { if (G_ATOMIC_INT_ADD (&set->control_pending, 1) == 0) {
/* raise when nothing pending */ /* raise when nothing pending */
GST_LOG ("%p: raise", set);
result = WAKE_EVENT (set); result = WAKE_EVENT (set);
} }
return result; return result;
@ -193,6 +194,7 @@ release_wakeup (GstPoll * set)
gboolean result = TRUE; gboolean result = TRUE;
if (g_atomic_int_dec_and_test (&set->control_pending)) { if (g_atomic_int_dec_and_test (&set->control_pending)) {
GST_LOG ("%p: release", set);
result = RELEASE_EVENT (set); result = RELEASE_EVENT (set);
} }
return result; return result;
@ -1418,12 +1420,10 @@ gst_poll_wait (GstPoll * set, GstClockTime timeout)
restarting = TRUE; restarting = TRUE;
} }
if (G_UNLIKELY (IS_FLUSHING (set))) { /* we got woken up and we are flushing, we need to stop */
/* we got woken up and we are flushing, we need to stop */ if (G_UNLIKELY (IS_FLUSHING (set)))
errno = EBUSY; goto flushing;
res = -1;
break;
}
} while (G_UNLIKELY (restarting)); } while (G_UNLIKELY (restarting));
DEC_WAITING (set); DEC_WAITING (set);
@ -1433,12 +1433,14 @@ gst_poll_wait (GstPoll * set, GstClockTime timeout)
/* ERRORS */ /* ERRORS */
already_waiting: already_waiting:
{ {
GST_LOG ("%p: we are already waiting", set);
DEC_WAITING (set); DEC_WAITING (set);
errno = EPERM; errno = EPERM;
return -1; return -1;
} }
flushing: flushing:
{ {
GST_LOG ("%p: we are flushing", set);
DEC_WAITING (set); DEC_WAITING (set);
errno = EBUSY; errno = EBUSY;
return -1; return -1;
@ -1446,6 +1448,7 @@ flushing:
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
winsock_error: winsock_error:
{ {
GST_LOG ("%p: winsock error", set);
g_mutex_unlock (set->lock); g_mutex_unlock (set->lock);
DEC_WAITING (set); DEC_WAITING (set);
return -1; return -1;
@ -1518,6 +1521,8 @@ gst_poll_set_flushing (GstPoll * set, gboolean flushing)
{ {
g_return_if_fail (set != NULL); g_return_if_fail (set != NULL);
GST_LOG ("%p: flushing: %d", set, flushing);
/* update the new state first */ /* update the new state first */
SET_FLUSHING (set, flushing); SET_FLUSHING (set, flushing);