RETSIGTYPE
file_polling_handler (int sig)
{
if (num_used_pollfds> 0)
{
_gst_disable_interrupts (true);
_gst_async_call (async_signal_polled_files, NULL);
_gst_enable_interrupts (true);
}
_gst_set_signal_handler (sig, file_polling_handler);
_gst_wakeup ();
}
...
set_file_interrupt (fd, file_polling_handler);
/* Now check if I/O was made possible while setting up our machinery...
If so, exit; otherwise, wait on the semaphore and the SIGIO
will wake us up. */
result = _gst_sync_file_polling (fd, cond);
if (result == 0)
{
if (!head)
head = new;
else
*p_tail_next = new;
p_tail_next =&new->next;
num_used_pollfds++;
_gst_register_oop (semaphoreOOP);
_gst_sync_wait (semaphoreOOP);
}
else
xfree (new);
...
Although it does a second poll after the sig handler setup trying to catch
this possibility, the data could still come in after the second poll but
before the _gst_sync_wait. The sig handler will trigger but it does not
prevent the process going to sleep.
From the look of it the problem is not limited to pipes, the same could
happen to sockets as well.