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

Comparing libev/ev.c (file contents):
Revision 1.94 by root, Sun Nov 11 01:29:49 2007 UTC vs.
Revision 1.98 by root, Sun Nov 11 02:05:20 2007 UTC

35 35
36#ifndef EV_STANDALONE 36#ifndef EV_STANDALONE
37# include "config.h" 37# include "config.h"
38 38
39# if HAVE_CLOCK_GETTIME 39# if HAVE_CLOCK_GETTIME
40# ifndef EV_USE_MONOTONIC
40# define EV_USE_MONOTONIC 1 41# define EV_USE_MONOTONIC 1
42# endif
43# ifndef EV_USE_REALTIME
41# define EV_USE_REALTIME 1 44# define EV_USE_REALTIME 1
45# endif
42# endif 46# endif
43 47
44# if HAVE_SELECT && HAVE_SYS_SELECT_H 48# if HAVE_SELECT && HAVE_SYS_SELECT_H && !defined (EV_USE_SELECT)
45# define EV_USE_SELECT 1 49# define EV_USE_SELECT 1
46# endif 50# endif
47 51
48# if HAVE_POLL && HAVE_POLL_H 52# if HAVE_POLL && HAVE_POLL_H && !defined (EV_USE_POLL)
49# define EV_USE_POLL 1 53# define EV_USE_POLL 1
50# endif 54# endif
51 55
52# if HAVE_EPOLL && HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H 56# if HAVE_EPOLL && HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H && !defined (EV_USE_EPOLL)
53# define EV_USE_EPOLL 1 57# define EV_USE_EPOLL 1
54# endif 58# endif
55 59
56# if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H 60# if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE)
57# define EV_USE_KQUEUE 1 61# define EV_USE_KQUEUE 1
58# endif 62# endif
59 63
60#endif 64#endif
61 65
157typedef struct ev_watcher_list *WL; 161typedef struct ev_watcher_list *WL;
158typedef struct ev_watcher_time *WT; 162typedef struct ev_watcher_time *WT;
159 163
160static int have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */ 164static int have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */
161 165
166#ifdef WIN32
162#include "ev_win32.c" 167# include "ev_win32.c"
168#endif
163 169
164/*****************************************************************************/ 170/*****************************************************************************/
165 171
166static void (*syserr_cb)(const char *msg); 172static void (*syserr_cb)(const char *msg);
167 173
1434 1440
1435void 1441void
1436ev_idle_stop (EV_P_ struct ev_idle *w) 1442ev_idle_stop (EV_P_ struct ev_idle *w)
1437{ 1443{
1438 ev_clear_pending (EV_A_ (W)w); 1444 ev_clear_pending (EV_A_ (W)w);
1439 if (!ev_is_active (w)) 1445 if (ev_is_active (w))
1440 return; 1446 return;
1441 1447
1442 idles [((W)w)->active - 1] = idles [--idlecnt]; 1448 idles [((W)w)->active - 1] = idles [--idlecnt];
1443 ev_stop (EV_A_ (W)w); 1449 ev_stop (EV_A_ (W)w);
1444} 1450}
1456 1462
1457void 1463void
1458ev_prepare_stop (EV_P_ struct ev_prepare *w) 1464ev_prepare_stop (EV_P_ struct ev_prepare *w)
1459{ 1465{
1460 ev_clear_pending (EV_A_ (W)w); 1466 ev_clear_pending (EV_A_ (W)w);
1461 if (!ev_is_active (w)) 1467 if (ev_is_active (w))
1462 return; 1468 return;
1463 1469
1464 prepares [((W)w)->active - 1] = prepares [--preparecnt]; 1470 prepares [((W)w)->active - 1] = prepares [--preparecnt];
1465 ev_stop (EV_A_ (W)w); 1471 ev_stop (EV_A_ (W)w);
1466} 1472}
1549 1555
1550void 1556void
1551ev_child_stop (EV_P_ struct ev_child *w) 1557ev_child_stop (EV_P_ struct ev_child *w)
1552{ 1558{
1553 ev_clear_pending (EV_A_ (W)w); 1559 ev_clear_pending (EV_A_ (W)w);
1554 if (ev_is_active (w)) 1560 if (!ev_is_active (w))
1555 return; 1561 return;
1556 1562
1557 wlist_del ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w); 1563 wlist_del ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w);
1558 ev_stop (EV_A_ (W)w); 1564 ev_stop (EV_A_ (W)w);
1559} 1565}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines