1 | /* |
1 | /* |
2 | * libevent compatibility layer |
2 | * libevent compatibility layer |
3 | * |
3 | * |
4 | * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
284 | int event_pending (struct event *ev, short events, struct timeval *tv) |
284 | int event_pending (struct event *ev, short events, struct timeval *tv) |
285 | { |
285 | { |
286 | short revents = 0; |
286 | short revents = 0; |
287 | dLOOPev; |
287 | dLOOPev; |
288 | |
288 | |
289 | |
|
|
290 | if (ev->ev_events & EV_SIGNAL) |
289 | if (ev->ev_events & EV_SIGNAL) |
291 | { |
290 | { |
292 | /* sig */ |
291 | /* sig */ |
293 | if (ev_is_active (&ev->iosig.sig) || ev_is_pending (&ev->iosig.sig)) |
292 | if (ev_is_active (&ev->iosig.sig) || ev_is_pending (&ev->iosig.sig)) |
294 | revents |= EV_SIGNAL; |
293 | revents |= EV_SIGNAL; |
… | |
… | |
357 | ev_tstamp after = tv_get (tv); |
356 | ev_tstamp after = tv_get (tv); |
358 | dLOOPbase; |
357 | dLOOPbase; |
359 | |
358 | |
360 | ev_once (EV_A_ -1, 0, after >= 0. ? after : 0., x_loopexit_cb, (void *)base); |
359 | ev_once (EV_A_ -1, 0, after >= 0. ? after : 0., x_loopexit_cb, (void *)base); |
361 | |
360 | |
362 | return -1; |
361 | return 0; |
363 | } |
362 | } |
364 | |
363 | |
365 | struct x_once |
364 | struct x_once |
366 | { |
365 | { |
367 | int fd; |
366 | int fd; |