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

Comparing libev/ev_poll.c (file contents):
Revision 1.9 by root, Tue Nov 6 17:09:45 2007 UTC vs.
Revision 1.10 by root, Thu Nov 8 17:24:00 2007 UTC

50 50
51 idx = pollidxs [fd]; 51 idx = pollidxs [fd];
52 52
53 if (idx < 0) /* need to allocate a new pollfd */ 53 if (idx < 0) /* need to allocate a new pollfd */
54 { 54 {
55 idx = pollcnt++; 55 pollidxs [fd] = idx = pollcnt++;
56 array_needsize (struct pollfd, polls, pollmax, pollcnt, ); 56 array_needsize (struct pollfd, polls, pollmax, pollcnt, );
57 polls [idx].fd = fd; 57 polls [idx].fd = fd;
58 } 58 }
59
60 assert (polls [idx].fd == fd);
59 61
60 if (nev) 62 if (nev)
61 polls [idx].events = 63 polls [idx].events =
62 (nev & EV_READ ? POLLIN : 0) 64 (nev & EV_READ ? POLLIN : 0)
63 | (nev & EV_WRITE ? POLLOUT : 0); 65 | (nev & EV_WRITE ? POLLOUT : 0);
64 else /* remove pollfd */ 66 else /* remove pollfd */
65 { 67 {
68 pollidxs [fd] = -1;
69
66 if (idx < pollcnt--) 70 if (idx < --pollcnt)
67 { 71 {
68 pollidxs [fd] = -1;
69 polls [idx] = polls [pollcnt]; 72 polls [idx] = polls [pollcnt];
70 pollidxs [polls [idx].fd] = idx; 73 pollidxs [polls [idx].fd] = idx;
71 } 74 }
72 } 75 }
73} 76}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines