ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev_epoll.c
(Generate patch)

Comparing libev/ev_epoll.c (file contents):
Revision 1.41 by root, Wed Oct 29 07:10:16 2008 UTC vs.
Revision 1.43 by root, Fri Nov 7 15:07:50 2008 UTC

68 /* 68 /*
69 * we handle EPOLL_CTL_DEL by ignoring it here 69 * we handle EPOLL_CTL_DEL by ignoring it here
70 * on the assumption that the fd is gone anyways 70 * on the assumption that the fd is gone anyways
71 * if that is wrong, we have to handle the spurious 71 * if that is wrong, we have to handle the spurious
72 * event in epoll_poll. 72 * event in epoll_poll.
73 * the fd is later added, we try to ADD it, and, if that 73 * if the fd is added again, we try to ADD it, and, if that
74 * fails, we assume it still has the same eventmask. 74 * fails, we assume it still has the same eventmask.
75 */ 75 */
76 if (!nev) 76 if (!nev)
77 return; 77 return;
78 78
79 oldmask = anfds [fd].emask; 79 oldmask = anfds [fd].emask;
80 anfds [fd].emask = nev; 80 anfds [fd].emask = nev;
81 81
82 /* store the generation counter in the upper 32 bits */ 82 /* store the generation counter in the upper 32 bits, the fd in the lower 32 bits */
83 ev.data.u64 = (uint64_t)(uint32_t)fd | ((uint64_t)(uint32_t)++anfds [fd].egen << 32); 83 ev.data.u64 = (uint64_t)(uint32_t)fd
84 | ((uint64_t)(uint32_t)++anfds [fd].egen << 32);
84 ev.events = (nev & EV_READ ? EPOLLIN : 0) 85 ev.events = (nev & EV_READ ? EPOLLIN : 0)
85 | (nev & EV_WRITE ? EPOLLOUT : 0); 86 | (nev & EV_WRITE ? EPOLLOUT : 0);
86 87
87 if (expect_true (!epoll_ctl (backend_fd, oev ? EPOLL_CTL_MOD : EPOLL_CTL_ADD, fd, &ev))) 88 if (expect_true (!epoll_ctl (backend_fd, oev ? EPOLL_CTL_MOD : EPOLL_CTL_ADD, fd, &ev)))
88 return; 89 return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines