Ejemplo n.º 1
0
/*
 * scamper_fd_write_unpause
 *
 * monitor write events on the fd.  unset the inactive flag, and push the
 * node back onto the write list
 */
void scamper_fd_write_unpause(scamper_fd_t *fdn)
{
  assert(fdn->write.cb != NULL);

  if((fdn->write.flags & SCAMPER_FD_POLL_FLAG_INACTIVE) != 0)
    {
      fdn->write.flags &= ~(SCAMPER_FD_POLL_FLAG_INACTIVE);

#ifdef HAVE_KQUEUE
      if(kq != -1)
	fds_kqueue_set(fdn, EVFILT_WRITE, EV_ADD);
#endif

#ifdef HAVE_EPOLL
      if(ep != -1)
	fds_epoll_ctl(fdn, EPOLLOUT, EPOLL_CTL_ADD);
#endif

      /*
       * the fd may still be on the write fds list, just with the inactive bit
       * set.  if it isn't, then we have to put it on the queue.
       */
      if(fdn->write.list != write_fds)
	{
	  dlist_node_head_push(write_queue, fdn->write.node);
	  fdn->write.list = write_queue;
	}
    }

  return;
}
Ejemplo n.º 2
0
dlist_node_t *dlist_head_push_dm(dlist_t *list, void *item,
				 const char *file, const int line)
#endif
{
  dlist_node_t *node;

  assert(list != NULL);
  assert(list->lock == 0);

#ifndef DMALLOC
  if((node = dlist_node(item, NULL, NULL)) != NULL)
#else
  if((node = dlist_node(item, NULL, NULL, file, line)) != NULL)
#endif
    {
      dlist_node_head_push(list, node);
    }

  return node;
}