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.6 by root, Sun Nov 4 23:14:11 2007 UTC vs.
Revision 1.7 by root, Tue Nov 6 00:10:04 2007 UTC

73} 73}
74 74
75static void 75static void
76poll_poll (EV_P_ ev_tstamp timeout) 76poll_poll (EV_P_ ev_tstamp timeout)
77{ 77{
78 int i;
78 int res = poll (polls, pollcnt, ceil (timeout * 1000.)); 79 int res = poll (polls, pollcnt, ceil (timeout * 1000.));
79 80
80 if (res > 0) 81 if (res < 0)
81 {
82 int i;
83
84 for (i = 0; i < pollcnt; ++i)
85 fd_event (
86 EV_A_
87 polls [i].fd,
88 (polls [i].revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0)
89 | (polls [i].revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0)
90 );
91 }
92 else if (res < 0)
93 { 82 {
94 if (errno == EBADF) 83 if (errno == EBADF)
95 fd_ebadf (EV_A); 84 fd_ebadf (EV_A);
96 else if (errno == ENOMEM) 85 else if (errno == ENOMEM && !syserr_cb)
97 fd_enomem (EV_A); 86 fd_enomem (EV_A);
87 else if (errno != EINTR)
88 syserr ();
89
90 return;
98 } 91 }
92
93 for (i = 0; i < pollcnt; ++i)
94 fd_event (
95 EV_A_
96 polls [i].fd,
97 (polls [i].revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0)
98 | (polls [i].revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0)
99 );
99} 100}
100 101
101static int 102static int
102poll_init (EV_P_ int flags) 103poll_init (EV_P_ int flags)
103{ 104{
112} 113}
113 114
114static void 115static void
115poll_destroy (EV_P) 116poll_destroy (EV_P)
116{ 117{
117 free (pollidxs); 118 ev_free (pollidxs);
118 free (polls); 119 ev_free (polls);
119} 120}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines