~ubuntu-branches/ubuntu/vivid/nodejs/vivid

« back to all changes in this revision

Viewing changes to deps/uv/src/unix/kqueue.c

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-11-13 23:17:51 UTC
  • mfrom: (1.1.29)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20131113231751-m6uqywp5dc4s4fxo
Tags: 0.10.22~dfsg1-1
* Upstream update. 
* Refresh patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
 
163
163
    nevents = 0;
164
164
 
 
165
    assert(loop->watchers != NULL);
 
166
    loop->watchers[loop->nwatchers] = (void*) events;
 
167
    loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
165
168
    for (i = 0; i < nfds; i++) {
166
169
      ev = events + i;
167
170
      fd = ev->ident;
168
171
      w = loop->watchers[fd];
169
172
 
 
173
      /* Skip invalidated events, see uv__platform_invalidate_fd */
 
174
      if (fd == -1)
 
175
        continue;
 
176
 
170
177
      if (w == NULL) {
171
178
        /* File descriptor that we've stopped watching, disarm it. */
172
179
        /* TODO batch up */
191
198
      revents = 0;
192
199
 
193
200
      if (ev->filter == EVFILT_READ) {
194
 
        if (w->events & UV__POLLIN) {
 
201
        if (w->pevents & UV__POLLIN) {
195
202
          revents |= UV__POLLIN;
196
203
          w->rcount = ev->data;
197
204
        } else {
205
212
      }
206
213
 
207
214
      if (ev->filter == EVFILT_WRITE) {
208
 
        if (w->events & UV__POLLOUT) {
 
215
        if (w->pevents & UV__POLLOUT) {
209
216
          revents |= UV__POLLOUT;
210
217
          w->wcount = ev->data;
211
218
        } else {
227
234
      w->cb(loop, w, revents);
228
235
      nevents++;
229
236
    }
 
237
    loop->watchers[loop->nwatchers] = NULL;
 
238
    loop->watchers[loop->nwatchers + 1] = NULL;
230
239
 
231
240
    if (nevents != 0) {
232
241
      if (nfds == ARRAY_SIZE(events) && --count != 0) {