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.17 by root, Wed Nov 28 11:15:55 2007 UTC vs.
Revision 1.18 by root, Sun Dec 9 02:12:44 2007 UTC

29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <poll.h> 32#include <poll.h>
33 33
34static void 34void inline_size
35pollidx_init (int *base, int count) 35pollidx_init (int *base, int count)
36{ 36{
37 while (count--) 37 while (count--)
38 *base++ = -1; 38 *base++ = -1;
39} 39}
65 | (nev & EV_WRITE ? POLLOUT : 0); 65 | (nev & EV_WRITE ? POLLOUT : 0);
66 else /* remove pollfd */ 66 else /* remove pollfd */
67 { 67 {
68 pollidxs [fd] = -1; 68 pollidxs [fd] = -1;
69 69
70 if (idx < --pollcnt) 70 if (expect_true (idx < --pollcnt))
71 { 71 {
72 polls [idx] = polls [pollcnt]; 72 polls [idx] = polls [pollcnt];
73 pollidxs [polls [idx].fd] = idx; 73 pollidxs [polls [idx].fd] = idx;
74 } 74 }
75 } 75 }
79poll_poll (EV_P_ ev_tstamp timeout) 79poll_poll (EV_P_ ev_tstamp timeout)
80{ 80{
81 int i; 81 int i;
82 int res = poll (polls, pollcnt, (int)ceil (timeout * 1000.)); 82 int res = poll (polls, pollcnt, (int)ceil (timeout * 1000.));
83 83
84 if (res < 0) 84 if (expect_false (res < 0))
85 { 85 {
86 if (errno == EBADF) 86 if (errno == EBADF)
87 fd_ebadf (EV_A); 87 fd_ebadf (EV_A);
88 else if (errno == ENOMEM && !syserr_cb) 88 else if (errno == ENOMEM && !syserr_cb)
89 fd_enomem (EV_A); 89 fd_enomem (EV_A);
92 92
93 return; 93 return;
94 } 94 }
95 95
96 for (i = 0; i < pollcnt; ++i) 96 for (i = 0; i < pollcnt; ++i)
97 if (polls [i].revents & POLLNVAL) 97 if (expect_false (polls [i].revents & POLLNVAL))
98 fd_kill (EV_A_ polls [i].fd); 98 fd_kill (EV_A_ polls [i].fd);
99 else 99 else
100 fd_event ( 100 fd_event (
101 EV_A_ 101 EV_A_
102 polls [i].fd, 102 polls [i].fd,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines