/* Using this API forces the linear scanning of event sources on each main loop iteration. Newly-written event sources should try to use g_source_add_unix_fd() instead of this API.  */
void g_source_add_poll(GSource *source, GPollFD *fd)
/* Using this API forces the linear scanning of event sources on each main loop iteration. Newly-written event sources should try to use g_source_add_unix_fd() instead of this API.  */
void g_source_add_poll(GSource *source, GPollFD *fd)
{
  GMainContext *context;
  g_return_if_fail (source != NULL);
  g_return_if_fail (fd != NULL);
  g_return_if_fail (!SOURCE_DESTROYED (source));
  context = source->context;
  if (context)
    LOCK_CONTEXT (context);
  source->poll_fds = g_slist_prepend (source->poll_fds, fd);
  if (context)
    {
      if (!SOURCE_BLOCKED (source))
	g_main_context_add_poll_unlocked (context, source->priority, fd);
      UNLOCK_CONTEXT (context);
    }
}