Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. while (!QUEUE_EMPTY(&loop->watcher_queue)) {
  2. q = QUEUE_HEAD(&loop->watcher_queue);
  3. QUEUE_REMOVE(q);
  4. QUEUE_INIT(q);
  5.  
  6. w = QUEUE_DATA(q, uv__io_t, watcher_queue);
  7. assert(w->pevents != 0);
  8. assert(w->fd >= 0);
  9. assert(w->fd < (int) loop->nwatchers);
  10.  
  11. e.events = w->pevents;
  12. e.data = w->fd;
  13.  
  14. if (w->events == 0)
  15. op = UV__EPOLL_CTL_ADD;
  16. else
  17. op = UV__EPOLL_CTL_MOD;
  18. if (uv__epoll_ctl(loop->backend_fd, op, w->fd, &e)) {
  19. if (errno != EEXIST)
  20. abort();
  21. if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_MOD, w->fd, &e))
  22. abort();
  23. }
  24.  
  25. w->events = w->pevents;
  26. }
  27.  
  28. for(;;){
  29. nfds = uv__epoll_wait(loop->backend_fd,
  30. events,
  31. ARRAY_SIZE(events),
  32. timeout);
  33. //... run callback for every events.
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement