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

Comparing libev/ev.c (file contents):
Revision 1.105 by root, Mon Nov 12 01:02:09 2007 UTC vs.
Revision 1.118 by root, Fri Nov 16 01:33:54 2007 UTC

47 47
48# if HAVE_SELECT && HAVE_SYS_SELECT_H && !defined (EV_USE_SELECT) 48# if HAVE_SELECT && HAVE_SYS_SELECT_H && !defined (EV_USE_SELECT)
49# define EV_USE_SELECT 1 49# define EV_USE_SELECT 1
50# endif 50# endif
51 51
52# if HAVE_POLL && HAVE_POLL_H && !defined (EV_USE_POLL) && !defined (__APPLE__) 52# if HAVE_POLL && HAVE_POLL_H && !defined (EV_USE_POLL)
53# define EV_USE_POLL 1 53# define EV_USE_POLL 1
54# endif 54# endif
55 55
56# if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H && !defined (EV_USE_EPOLL) 56# if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H && !defined (EV_USE_EPOLL)
57# define EV_USE_EPOLL 1 57# define EV_USE_EPOLL 1
58# endif 58# endif
59 59
60# if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE) && !defined (__APPLE__) 60# if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE)
61# define EV_USE_KQUEUE 1 61# define EV_USE_KQUEUE 1
62# endif
63
64# if HAVE_PORT_H && HAVE_PORT_H && HAVE_PORT_CREATE && !defined (EV_USE_PORT)
65# define EV_USE_PORT 1
62# endif 66# endif
63 67
64#endif 68#endif
65 69
66#include <math.h> 70#include <math.h>
93 97
94#ifndef EV_USE_MONOTONIC 98#ifndef EV_USE_MONOTONIC
95# define EV_USE_MONOTONIC 1 99# define EV_USE_MONOTONIC 1
96#endif 100#endif
97 101
102#ifndef EV_USE_REALTIME
103# define EV_USE_REALTIME 1
104#endif
105
98#ifndef EV_USE_SELECT 106#ifndef EV_USE_SELECT
99# define EV_USE_SELECT 1 107# define EV_USE_SELECT 1
100# define EV_SELECT_USE_FD_SET 1 108# define EV_SELECT_USE_FD_SET 1
101#endif 109#endif
102 110
114 122
115#ifndef EV_USE_KQUEUE 123#ifndef EV_USE_KQUEUE
116# define EV_USE_KQUEUE 0 124# define EV_USE_KQUEUE 0
117#endif 125#endif
118 126
119#ifndef EV_USE_REALTIME 127#ifndef EV_USE_PORT
120# define EV_USE_REALTIME 1 128# define EV_USE_PORT 0
121#endif 129#endif
122 130
123/**/ 131/**/
132
133/* darwin simply cannot be helped */
134#ifdef __APPLE__
135# undef EV_USE_POLL
136# undef EV_USE_KQUEUE
137#endif
124 138
125#ifndef CLOCK_MONOTONIC 139#ifndef CLOCK_MONOTONIC
126# undef EV_USE_MONOTONIC 140# undef EV_USE_MONOTONIC
127# define EV_USE_MONOTONIC 0 141# define EV_USE_MONOTONIC 0
128#endif 142#endif
161#define expect_true(expr) expect ((expr) != 0, 1) 175#define expect_true(expr) expect ((expr) != 0, 1)
162 176
163#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) 177#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
164#define ABSPRI(w) ((w)->priority - EV_MINPRI) 178#define ABSPRI(w) ((w)->priority - EV_MINPRI)
165 179
166#define EMPTY /* required for microsofts broken pseudo-c compiler */ 180#define EMPTY0 /* required for microsofts broken pseudo-c compiler */
181#define EMPTY2(a,b) /* used to suppress some warnings */
167 182
168typedef struct ev_watcher *W; 183typedef struct ev_watcher *W;
169typedef struct ev_watcher_list *WL; 184typedef struct ev_watcher_list *WL;
170typedef struct ev_watcher_time *WT; 185typedef struct ev_watcher_time *WT;
171 186
251 #include "ev_vars.h" 266 #include "ev_vars.h"
252 #undef VAR 267 #undef VAR
253 }; 268 };
254 #include "ev_wrap.h" 269 #include "ev_wrap.h"
255 270
256 struct ev_loop default_loop_struct; 271 static struct ev_loop default_loop_struct;
257 static struct ev_loop *default_loop; 272 struct ev_loop *ev_default_loop_ptr;
258 273
259#else 274#else
260 275
261 ev_tstamp ev_rt_now; 276 ev_tstamp ev_rt_now;
262 #define VAR(name,decl) static decl; 277 #define VAR(name,decl) static decl;
263 #include "ev_vars.h" 278 #include "ev_vars.h"
264 #undef VAR 279 #undef VAR
265 280
266 static int default_loop; 281 static int ev_default_loop_ptr;
267 282
268#endif 283#endif
269 284
270/*****************************************************************************/ 285/*****************************************************************************/
271 286
304{ 319{
305 return ev_rt_now; 320 return ev_rt_now;
306} 321}
307#endif 322#endif
308 323
309#define array_roundsize(type,n) ((n) | 4 & ~3) 324#define array_roundsize(type,n) (((n) | 4) & ~3)
310 325
311#define array_needsize(type,base,cur,cnt,init) \ 326#define array_needsize(type,base,cur,cnt,init) \
312 if (expect_false ((cnt) > cur)) \ 327 if (expect_false ((cnt) > cur)) \
313 { \ 328 { \
314 int newcnt = cur; \ 329 int newcnt = cur; \
359 pendings [ABSPRI (w_)][w_->pending - 1].events |= revents; 374 pendings [ABSPRI (w_)][w_->pending - 1].events |= revents;
360 return; 375 return;
361 } 376 }
362 377
363 w_->pending = ++pendingcnt [ABSPRI (w_)]; 378 w_->pending = ++pendingcnt [ABSPRI (w_)];
364 array_needsize (ANPENDING, pendings [ABSPRI (w_)], pendingmax [ABSPRI (w_)], pendingcnt [ABSPRI (w_)], (void)); 379 array_needsize (ANPENDING, pendings [ABSPRI (w_)], pendingmax [ABSPRI (w_)], pendingcnt [ABSPRI (w_)], EMPTY2);
365 pendings [ABSPRI (w_)][w_->pending - 1].w = w_; 380 pendings [ABSPRI (w_)][w_->pending - 1].w = w_;
366 pendings [ABSPRI (w_)][w_->pending - 1].events = revents; 381 pendings [ABSPRI (w_)][w_->pending - 1].events = revents;
367} 382}
368 383
369static void 384static void
439 return; 454 return;
440 455
441 anfds [fd].reify = 1; 456 anfds [fd].reify = 1;
442 457
443 ++fdchangecnt; 458 ++fdchangecnt;
444 array_needsize (int, fdchanges, fdchangemax, fdchangecnt, (void)); 459 array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2);
445 fdchanges [fdchangecnt - 1] = fd; 460 fdchanges [fdchangecnt - 1] = fd;
446} 461}
447 462
448static void 463static void
449fd_kill (EV_P_ int fd) 464fd_kill (EV_P_ int fd)
607ev_feed_signal_event (EV_P_ int signum) 622ev_feed_signal_event (EV_P_ int signum)
608{ 623{
609 WL w; 624 WL w;
610 625
611#if EV_MULTIPLICITY 626#if EV_MULTIPLICITY
612 assert (("feeding signal events is only supported in the default loop", loop == default_loop)); 627 assert (("feeding signal events is only supported in the default loop", loop == ev_default_loop_ptr));
613#endif 628#endif
614 629
615 --signum; 630 --signum;
616 631
617 if (signum < 0 || signum >= signalmax) 632 if (signum < 0 || signum >= signalmax)
703 718
704#endif 719#endif
705 720
706/*****************************************************************************/ 721/*****************************************************************************/
707 722
723#if EV_USE_PORT
724# include "ev_port.c"
725#endif
708#if EV_USE_KQUEUE 726#if EV_USE_KQUEUE
709# include "ev_kqueue.c" 727# include "ev_kqueue.c"
710#endif 728#endif
711#if EV_USE_EPOLL 729#if EV_USE_EPOLL
712# include "ev_epoll.c" 730# include "ev_epoll.c"
740 return getuid () != geteuid () 758 return getuid () != geteuid ()
741 || getgid () != getegid (); 759 || getgid () != getegid ();
742#endif 760#endif
743} 761}
744 762
745int 763unsigned int
746ev_method (EV_P) 764ev_method (EV_P)
747{ 765{
748 return method; 766 return method;
749} 767}
750 768
751static void 769static void
752loop_init (EV_P_ int methods) 770loop_init (EV_P_ unsigned int flags)
753{ 771{
754 if (!method) 772 if (!method)
755 { 773 {
756#if EV_USE_MONOTONIC 774#if EV_USE_MONOTONIC
757 { 775 {
764 ev_rt_now = ev_time (); 782 ev_rt_now = ev_time ();
765 mn_now = get_clock (); 783 mn_now = get_clock ();
766 now_floor = mn_now; 784 now_floor = mn_now;
767 rtmn_diff = ev_rt_now - mn_now; 785 rtmn_diff = ev_rt_now - mn_now;
768 786
769 if (methods == EVMETHOD_AUTO) 787 if (!(flags & EVFLAG_NOENV) && !enable_secure () && getenv ("LIBEV_FLAGS"))
770 if (!enable_secure () && getenv ("LIBEV_METHODS"))
771 methods = atoi (getenv ("LIBEV_METHODS")); 788 flags = atoi (getenv ("LIBEV_FLAGS"));
772 else 789
773 methods = EVMETHOD_ANY; 790 if (!(flags & 0x0000ffff))
791 flags |= 0x0000ffff;
774 792
775 method = 0; 793 method = 0;
794#if EV_USE_PORT
795 if (!method && (flags & EVMETHOD_PORT )) method = port_init (EV_A_ flags);
796#endif
776#if EV_USE_KQUEUE 797#if EV_USE_KQUEUE
777 if (!method && (methods & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ methods); 798 if (!method && (flags & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ flags);
778#endif 799#endif
779#if EV_USE_EPOLL 800#if EV_USE_EPOLL
780 if (!method && (methods & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ methods); 801 if (!method && (flags & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ flags);
781#endif 802#endif
782#if EV_USE_POLL 803#if EV_USE_POLL
783 if (!method && (methods & EVMETHOD_POLL )) method = poll_init (EV_A_ methods); 804 if (!method && (flags & EVMETHOD_POLL )) method = poll_init (EV_A_ flags);
784#endif 805#endif
785#if EV_USE_SELECT 806#if EV_USE_SELECT
786 if (!method && (methods & EVMETHOD_SELECT)) method = select_init (EV_A_ methods); 807 if (!method && (flags & EVMETHOD_SELECT)) method = select_init (EV_A_ flags);
787#endif 808#endif
788 809
789 ev_init (&sigev, sigcb); 810 ev_init (&sigev, sigcb);
790 ev_set_priority (&sigev, EV_MAXPRI); 811 ev_set_priority (&sigev, EV_MAXPRI);
791 } 812 }
794void 815void
795loop_destroy (EV_P) 816loop_destroy (EV_P)
796{ 817{
797 int i; 818 int i;
798 819
820#if EV_USE_PORT
821 if (method == EVMETHOD_PORT ) port_destroy (EV_A);
822#endif
799#if EV_USE_KQUEUE 823#if EV_USE_KQUEUE
800 if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); 824 if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A);
801#endif 825#endif
802#if EV_USE_EPOLL 826#if EV_USE_EPOLL
803 if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A); 827 if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A);
811 835
812 for (i = NUMPRI; i--; ) 836 for (i = NUMPRI; i--; )
813 array_free (pending, [i]); 837 array_free (pending, [i]);
814 838
815 /* have to use the microsoft-never-gets-it-right macro */ 839 /* have to use the microsoft-never-gets-it-right macro */
816 array_free (fdchange, EMPTY); 840 array_free (fdchange, EMPTY0);
817 array_free (timer, EMPTY); 841 array_free (timer, EMPTY0);
818#if EV_PERIODICS 842#if EV_PERIODICS
819 array_free (periodic, EMPTY); 843 array_free (periodic, EMPTY0);
820#endif 844#endif
821 array_free (idle, EMPTY); 845 array_free (idle, EMPTY0);
822 array_free (prepare, EMPTY); 846 array_free (prepare, EMPTY0);
823 array_free (check, EMPTY); 847 array_free (check, EMPTY0);
824 848
825 method = 0; 849 method = 0;
826} 850}
827 851
828static void 852static void
829loop_fork (EV_P) 853loop_fork (EV_P)
830{ 854{
855#if EV_USE_PORT
856 if (method == EVMETHOD_PORT ) port_fork (EV_A);
857#endif
858#if EV_USE_KQUEUE
859 if (method == EVMETHOD_KQUEUE) kqueue_fork (EV_A);
860#endif
831#if EV_USE_EPOLL 861#if EV_USE_EPOLL
832 if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A); 862 if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A);
833#endif
834#if EV_USE_KQUEUE
835 if (method == EVMETHOD_KQUEUE) kqueue_fork (EV_A);
836#endif 863#endif
837 864
838 if (ev_is_active (&sigev)) 865 if (ev_is_active (&sigev))
839 { 866 {
840 /* default loop */ 867 /* default loop */
853 postfork = 0; 880 postfork = 0;
854} 881}
855 882
856#if EV_MULTIPLICITY 883#if EV_MULTIPLICITY
857struct ev_loop * 884struct ev_loop *
858ev_loop_new (int methods) 885ev_loop_new (unsigned int flags)
859{ 886{
860 struct ev_loop *loop = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop)); 887 struct ev_loop *loop = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop));
861 888
862 memset (loop, 0, sizeof (struct ev_loop)); 889 memset (loop, 0, sizeof (struct ev_loop));
863 890
864 loop_init (EV_A_ methods); 891 loop_init (EV_A_ flags);
865 892
866 if (ev_method (EV_A)) 893 if (ev_method (EV_A))
867 return loop; 894 return loop;
868 895
869 return 0; 896 return 0;
884 911
885#endif 912#endif
886 913
887#if EV_MULTIPLICITY 914#if EV_MULTIPLICITY
888struct ev_loop * 915struct ev_loop *
916ev_default_loop_ (unsigned int flags)
889#else 917#else
890int 918int
919ev_default_loop (unsigned int flags)
891#endif 920#endif
892ev_default_loop (int methods)
893{ 921{
894 if (sigpipe [0] == sigpipe [1]) 922 if (sigpipe [0] == sigpipe [1])
895 if (pipe (sigpipe)) 923 if (pipe (sigpipe))
896 return 0; 924 return 0;
897 925
898 if (!default_loop) 926 if (!ev_default_loop_ptr)
899 { 927 {
900#if EV_MULTIPLICITY 928#if EV_MULTIPLICITY
901 struct ev_loop *loop = default_loop = &default_loop_struct; 929 struct ev_loop *loop = ev_default_loop_ptr = &default_loop_struct;
902#else 930#else
903 default_loop = 1; 931 ev_default_loop_ptr = 1;
904#endif 932#endif
905 933
906 loop_init (EV_A_ methods); 934 loop_init (EV_A_ flags);
907 935
908 if (ev_method (EV_A)) 936 if (ev_method (EV_A))
909 { 937 {
910 siginit (EV_A); 938 siginit (EV_A);
911 939
915 ev_signal_start (EV_A_ &childev); 943 ev_signal_start (EV_A_ &childev);
916 ev_unref (EV_A); /* child watcher should not keep loop alive */ 944 ev_unref (EV_A); /* child watcher should not keep loop alive */
917#endif 945#endif
918 } 946 }
919 else 947 else
920 default_loop = 0; 948 ev_default_loop_ptr = 0;
921 } 949 }
922 950
923 return default_loop; 951 return ev_default_loop_ptr;
924} 952}
925 953
926void 954void
927ev_default_destroy (void) 955ev_default_destroy (void)
928{ 956{
929#if EV_MULTIPLICITY 957#if EV_MULTIPLICITY
930 struct ev_loop *loop = default_loop; 958 struct ev_loop *loop = ev_default_loop_ptr;
931#endif 959#endif
932 960
933#ifndef _WIN32 961#ifndef _WIN32
934 ev_ref (EV_A); /* child watcher */ 962 ev_ref (EV_A); /* child watcher */
935 ev_signal_stop (EV_A_ &childev); 963 ev_signal_stop (EV_A_ &childev);
946 974
947void 975void
948ev_default_fork (void) 976ev_default_fork (void)
949{ 977{
950#if EV_MULTIPLICITY 978#if EV_MULTIPLICITY
951 struct ev_loop *loop = default_loop; 979 struct ev_loop *loop = ev_default_loop_ptr;
952#endif 980#endif
953 981
954 if (method) 982 if (method)
955 postfork = 1; 983 postfork = 1;
956} 984}
1025 assert (("inactive timer on periodic heap detected", ev_is_active (w))); 1053 assert (("inactive timer on periodic heap detected", ev_is_active (w)));
1026 1054
1027 /* first reschedule or stop timer */ 1055 /* first reschedule or stop timer */
1028 if (w->reschedule_cb) 1056 if (w->reschedule_cb)
1029 { 1057 {
1030 ev_tstamp at = ((WT)w)->at = w->reschedule_cb (w, ev_rt_now + 0.0001); 1058 ((WT)w)->at = w->reschedule_cb (w, ev_rt_now + 0.0001);
1031
1032 assert (("ev_periodic reschedule callback returned time in the past", ((WT)w)->at > ev_rt_now)); 1059 assert (("ev_periodic reschedule callback returned time in the past", ((WT)w)->at > ev_rt_now));
1033 downheap ((WT *)periodics, periodiccnt, 0); 1060 downheap ((WT *)periodics, periodiccnt, 0);
1034 } 1061 }
1035 else if (w->interval) 1062 else if (w->interval)
1036 { 1063 {
1154ev_loop (EV_P_ int flags) 1181ev_loop (EV_P_ int flags)
1155{ 1182{
1156 double block; 1183 double block;
1157 loop_done = flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK) ? 1 : 0; 1184 loop_done = flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK) ? 1 : 0;
1158 1185
1159 do 1186 while (activecnt)
1160 { 1187 {
1161 /* queue check watchers (and execute them) */ 1188 /* queue check watchers (and execute them) */
1162 if (expect_false (preparecnt)) 1189 if (expect_false (preparecnt))
1163 { 1190 {
1164 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); 1191 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE);
1227 /* queue check watchers, to be executed first */ 1254 /* queue check watchers, to be executed first */
1228 if (checkcnt) 1255 if (checkcnt)
1229 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); 1256 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK);
1230 1257
1231 call_pending (EV_A); 1258 call_pending (EV_A);
1259
1260 if (loop_done)
1261 break;
1232 } 1262 }
1233 while (activecnt && !loop_done);
1234 1263
1235 if (loop_done != 2) 1264 if (loop_done != 2)
1236 loop_done = 0; 1265 loop_done = 0;
1237} 1266}
1238 1267
1336 ((WT)w)->at += mn_now; 1365 ((WT)w)->at += mn_now;
1337 1366
1338 assert (("ev_timer_start called with negative timer repeat value", w->repeat >= 0.)); 1367 assert (("ev_timer_start called with negative timer repeat value", w->repeat >= 0.));
1339 1368
1340 ev_start (EV_A_ (W)w, ++timercnt); 1369 ev_start (EV_A_ (W)w, ++timercnt);
1341 array_needsize (struct ev_timer *, timers, timermax, timercnt, (void)); 1370 array_needsize (struct ev_timer *, timers, timermax, timercnt, EMPTY2);
1342 timers [timercnt - 1] = w; 1371 timers [timercnt - 1] = w;
1343 upheap ((WT *)timers, timercnt - 1); 1372 upheap ((WT *)timers, timercnt - 1);
1344 1373
1345 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); 1374 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));
1346} 1375}
1377 } 1406 }
1378 else 1407 else
1379 ev_timer_stop (EV_A_ w); 1408 ev_timer_stop (EV_A_ w);
1380 } 1409 }
1381 else if (w->repeat) 1410 else if (w->repeat)
1411 {
1412 w->at = w->repeat;
1382 ev_timer_start (EV_A_ w); 1413 ev_timer_start (EV_A_ w);
1414 }
1383} 1415}
1384 1416
1385#if EV_PERIODICS 1417#if EV_PERIODICS
1386void 1418void
1387ev_periodic_start (EV_P_ struct ev_periodic *w) 1419ev_periodic_start (EV_P_ struct ev_periodic *w)
1397 /* this formula differs from the one in periodic_reify because we do not always round up */ 1429 /* this formula differs from the one in periodic_reify because we do not always round up */
1398 ((WT)w)->at += ceil ((ev_rt_now - ((WT)w)->at) / w->interval) * w->interval; 1430 ((WT)w)->at += ceil ((ev_rt_now - ((WT)w)->at) / w->interval) * w->interval;
1399 } 1431 }
1400 1432
1401 ev_start (EV_A_ (W)w, ++periodiccnt); 1433 ev_start (EV_A_ (W)w, ++periodiccnt);
1402 array_needsize (struct ev_periodic *, periodics, periodicmax, periodiccnt, (void)); 1434 array_needsize (struct ev_periodic *, periodics, periodicmax, periodiccnt, EMPTY2);
1403 periodics [periodiccnt - 1] = w; 1435 periodics [periodiccnt - 1] = w;
1404 upheap ((WT *)periodics, periodiccnt - 1); 1436 upheap ((WT *)periodics, periodiccnt - 1);
1405 1437
1406 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); 1438 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));
1407} 1439}
1438{ 1470{
1439 if (ev_is_active (w)) 1471 if (ev_is_active (w))
1440 return; 1472 return;
1441 1473
1442 ev_start (EV_A_ (W)w, ++idlecnt); 1474 ev_start (EV_A_ (W)w, ++idlecnt);
1443 array_needsize (struct ev_idle *, idles, idlemax, idlecnt, (void)); 1475 array_needsize (struct ev_idle *, idles, idlemax, idlecnt, EMPTY2);
1444 idles [idlecnt - 1] = w; 1476 idles [idlecnt - 1] = w;
1445} 1477}
1446 1478
1447void 1479void
1448ev_idle_stop (EV_P_ struct ev_idle *w) 1480ev_idle_stop (EV_P_ struct ev_idle *w)
1460{ 1492{
1461 if (ev_is_active (w)) 1493 if (ev_is_active (w))
1462 return; 1494 return;
1463 1495
1464 ev_start (EV_A_ (W)w, ++preparecnt); 1496 ev_start (EV_A_ (W)w, ++preparecnt);
1465 array_needsize (struct ev_prepare *, prepares, preparemax, preparecnt, (void)); 1497 array_needsize (struct ev_prepare *, prepares, preparemax, preparecnt, EMPTY2);
1466 prepares [preparecnt - 1] = w; 1498 prepares [preparecnt - 1] = w;
1467} 1499}
1468 1500
1469void 1501void
1470ev_prepare_stop (EV_P_ struct ev_prepare *w) 1502ev_prepare_stop (EV_P_ struct ev_prepare *w)
1482{ 1514{
1483 if (ev_is_active (w)) 1515 if (ev_is_active (w))
1484 return; 1516 return;
1485 1517
1486 ev_start (EV_A_ (W)w, ++checkcnt); 1518 ev_start (EV_A_ (W)w, ++checkcnt);
1487 array_needsize (struct ev_check *, checks, checkmax, checkcnt, (void)); 1519 array_needsize (struct ev_check *, checks, checkmax, checkcnt, EMPTY2);
1488 checks [checkcnt - 1] = w; 1520 checks [checkcnt - 1] = w;
1489} 1521}
1490 1522
1491void 1523void
1492ev_check_stop (EV_P_ struct ev_check *w) 1524ev_check_stop (EV_P_ struct ev_check *w)
1505 1537
1506void 1538void
1507ev_signal_start (EV_P_ struct ev_signal *w) 1539ev_signal_start (EV_P_ struct ev_signal *w)
1508{ 1540{
1509#if EV_MULTIPLICITY 1541#if EV_MULTIPLICITY
1510 assert (("signal watchers are only supported in the default loop", loop == default_loop)); 1542 assert (("signal watchers are only supported in the default loop", loop == ev_default_loop_ptr));
1511#endif 1543#endif
1512 if (ev_is_active (w)) 1544 if (ev_is_active (w))
1513 return; 1545 return;
1514 1546
1515 assert (("ev_signal_start called with illegal signal number", w->signum > 0)); 1547 assert (("ev_signal_start called with illegal signal number", w->signum > 0));
1548 1580
1549void 1581void
1550ev_child_start (EV_P_ struct ev_child *w) 1582ev_child_start (EV_P_ struct ev_child *w)
1551{ 1583{
1552#if EV_MULTIPLICITY 1584#if EV_MULTIPLICITY
1553 assert (("child watchers are only supported in the default loop", loop == default_loop)); 1585 assert (("child watchers are only supported in the default loop", loop == ev_default_loop_ptr));
1554#endif 1586#endif
1555 if (ev_is_active (w)) 1587 if (ev_is_active (w))
1556 return; 1588 return;
1557 1589
1558 ev_start (EV_A_ (W)w, 1); 1590 ev_start (EV_A_ (W)w, 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines