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

Comparing libev/ev.c (file contents):
Revision 1.103 by root, Mon Nov 12 00:31:08 2007 UTC vs.
Revision 1.118 by root, Fri Nov 16 01:33:54 2007 UTC

59 59
60# if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE) 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 62# endif
63 63
64# if HAVE_PORT_H && HAVE_PORT_H && HAVE_PORT_CREATE && !defined (EV_USE_PORT)
65# define EV_USE_PORT 1
66# endif
67
64#endif 68#endif
65 69
66#include <math.h> 70#include <math.h>
67#include <stdlib.h> 71#include <stdlib.h>
68#include <fcntl.h> 72#include <fcntl.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
108# define EV_SELECT_USE_FD_SET 1
100#endif 109#endif
101 110
102#ifndef EV_USE_POLL 111#ifndef EV_USE_POLL
103# define EV_USE_POLL 0 /* poll is usually slower than select, and not as well tested */ 112# ifdef _WIN32
113# define EV_USE_POLL 0
114# else
115# define EV_USE_POLL 1
116# endif
104#endif 117#endif
105 118
106#ifndef EV_USE_EPOLL 119#ifndef EV_USE_EPOLL
107# define EV_USE_EPOLL 0 120# define EV_USE_EPOLL 0
108#endif 121#endif
109 122
110#ifndef EV_USE_KQUEUE 123#ifndef EV_USE_KQUEUE
111# define EV_USE_KQUEUE 0 124# define EV_USE_KQUEUE 0
112#endif 125#endif
113 126
114#ifndef EV_USE_REALTIME 127#ifndef EV_USE_PORT
115# define EV_USE_REALTIME 1 128# define EV_USE_PORT 0
116#endif 129#endif
117 130
118/**/ 131/**/
132
133/* darwin simply cannot be helped */
134#ifdef __APPLE__
135# undef EV_USE_POLL
136# undef EV_USE_KQUEUE
137#endif
119 138
120#ifndef CLOCK_MONOTONIC 139#ifndef CLOCK_MONOTONIC
121# undef EV_USE_MONOTONIC 140# undef EV_USE_MONOTONIC
122# define EV_USE_MONOTONIC 0 141# define EV_USE_MONOTONIC 0
123#endif 142#endif
156#define expect_true(expr) expect ((expr) != 0, 1) 175#define expect_true(expr) expect ((expr) != 0, 1)
157 176
158#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) 177#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
159#define ABSPRI(w) ((w)->priority - EV_MINPRI) 178#define ABSPRI(w) ((w)->priority - EV_MINPRI)
160 179
161#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 */
162 182
163typedef struct ev_watcher *W; 183typedef struct ev_watcher *W;
164typedef struct ev_watcher_list *WL; 184typedef struct ev_watcher_list *WL;
165typedef struct ev_watcher_time *WT; 185typedef struct ev_watcher_time *WT;
166 186
246 #include "ev_vars.h" 266 #include "ev_vars.h"
247 #undef VAR 267 #undef VAR
248 }; 268 };
249 #include "ev_wrap.h" 269 #include "ev_wrap.h"
250 270
251 struct ev_loop default_loop_struct; 271 static struct ev_loop default_loop_struct;
252 static struct ev_loop *default_loop; 272 struct ev_loop *ev_default_loop_ptr;
253 273
254#else 274#else
255 275
256 ev_tstamp ev_rt_now; 276 ev_tstamp ev_rt_now;
257 #define VAR(name,decl) static decl; 277 #define VAR(name,decl) static decl;
258 #include "ev_vars.h" 278 #include "ev_vars.h"
259 #undef VAR 279 #undef VAR
260 280
261 static int default_loop; 281 static int ev_default_loop_ptr;
262 282
263#endif 283#endif
264 284
265/*****************************************************************************/ 285/*****************************************************************************/
266 286
299{ 319{
300 return ev_rt_now; 320 return ev_rt_now;
301} 321}
302#endif 322#endif
303 323
304#define array_roundsize(type,n) ((n) | 4 & ~3) 324#define array_roundsize(type,n) (((n) | 4) & ~3)
305 325
306#define array_needsize(type,base,cur,cnt,init) \ 326#define array_needsize(type,base,cur,cnt,init) \
307 if (expect_false ((cnt) > cur)) \ 327 if (expect_false ((cnt) > cur)) \
308 { \ 328 { \
309 int newcnt = cur; \ 329 int newcnt = cur; \
354 pendings [ABSPRI (w_)][w_->pending - 1].events |= revents; 374 pendings [ABSPRI (w_)][w_->pending - 1].events |= revents;
355 return; 375 return;
356 } 376 }
357 377
358 w_->pending = ++pendingcnt [ABSPRI (w_)]; 378 w_->pending = ++pendingcnt [ABSPRI (w_)];
359 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);
360 pendings [ABSPRI (w_)][w_->pending - 1].w = w_; 380 pendings [ABSPRI (w_)][w_->pending - 1].w = w_;
361 pendings [ABSPRI (w_)][w_->pending - 1].events = revents; 381 pendings [ABSPRI (w_)][w_->pending - 1].events = revents;
362} 382}
363 383
364static void 384static void
434 return; 454 return;
435 455
436 anfds [fd].reify = 1; 456 anfds [fd].reify = 1;
437 457
438 ++fdchangecnt; 458 ++fdchangecnt;
439 array_needsize (int, fdchanges, fdchangemax, fdchangecnt, (void)); 459 array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2);
440 fdchanges [fdchangecnt - 1] = fd; 460 fdchanges [fdchangecnt - 1] = fd;
441} 461}
442 462
443static void 463static void
444fd_kill (EV_P_ int fd) 464fd_kill (EV_P_ int fd)
602ev_feed_signal_event (EV_P_ int signum) 622ev_feed_signal_event (EV_P_ int signum)
603{ 623{
604 WL w; 624 WL w;
605 625
606#if EV_MULTIPLICITY 626#if EV_MULTIPLICITY
607 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));
608#endif 628#endif
609 629
610 --signum; 630 --signum;
611 631
612 if (signum < 0 || signum >= signalmax) 632 if (signum < 0 || signum >= signalmax)
698 718
699#endif 719#endif
700 720
701/*****************************************************************************/ 721/*****************************************************************************/
702 722
723#if EV_USE_PORT
724# include "ev_port.c"
725#endif
703#if EV_USE_KQUEUE 726#if EV_USE_KQUEUE
704# include "ev_kqueue.c" 727# include "ev_kqueue.c"
705#endif 728#endif
706#if EV_USE_EPOLL 729#if EV_USE_EPOLL
707# include "ev_epoll.c" 730# include "ev_epoll.c"
735 return getuid () != geteuid () 758 return getuid () != geteuid ()
736 || getgid () != getegid (); 759 || getgid () != getegid ();
737#endif 760#endif
738} 761}
739 762
740int 763unsigned int
741ev_method (EV_P) 764ev_method (EV_P)
742{ 765{
743 return method; 766 return method;
744} 767}
745 768
746static void 769static void
747loop_init (EV_P_ int methods) 770loop_init (EV_P_ unsigned int flags)
748{ 771{
749 if (!method) 772 if (!method)
750 { 773 {
751#if EV_USE_MONOTONIC 774#if EV_USE_MONOTONIC
752 { 775 {
759 ev_rt_now = ev_time (); 782 ev_rt_now = ev_time ();
760 mn_now = get_clock (); 783 mn_now = get_clock ();
761 now_floor = mn_now; 784 now_floor = mn_now;
762 rtmn_diff = ev_rt_now - mn_now; 785 rtmn_diff = ev_rt_now - mn_now;
763 786
764 if (methods == EVMETHOD_AUTO) 787 if (!(flags & EVFLAG_NOENV) && !enable_secure () && getenv ("LIBEV_FLAGS"))
765 if (!enable_secure () && getenv ("LIBEV_METHODS"))
766 methods = atoi (getenv ("LIBEV_METHODS")); 788 flags = atoi (getenv ("LIBEV_FLAGS"));
767 else 789
768 methods = EVMETHOD_ANY; 790 if (!(flags & 0x0000ffff))
791 flags |= 0x0000ffff;
769 792
770 method = 0; 793 method = 0;
794#if EV_USE_PORT
795 if (!method && (flags & EVMETHOD_PORT )) method = port_init (EV_A_ flags);
796#endif
771#if EV_USE_KQUEUE 797#if EV_USE_KQUEUE
772 if (!method && (methods & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ methods); 798 if (!method && (flags & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ flags);
773#endif 799#endif
774#if EV_USE_EPOLL 800#if EV_USE_EPOLL
775 if (!method && (methods & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ methods); 801 if (!method && (flags & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ flags);
776#endif 802#endif
777#if EV_USE_POLL 803#if EV_USE_POLL
778 if (!method && (methods & EVMETHOD_POLL )) method = poll_init (EV_A_ methods); 804 if (!method && (flags & EVMETHOD_POLL )) method = poll_init (EV_A_ flags);
779#endif 805#endif
780#if EV_USE_SELECT 806#if EV_USE_SELECT
781 if (!method && (methods & EVMETHOD_SELECT)) method = select_init (EV_A_ methods); 807 if (!method && (flags & EVMETHOD_SELECT)) method = select_init (EV_A_ flags);
782#endif 808#endif
783 809
784 ev_init (&sigev, sigcb); 810 ev_init (&sigev, sigcb);
785 ev_set_priority (&sigev, EV_MAXPRI); 811 ev_set_priority (&sigev, EV_MAXPRI);
786 } 812 }
789void 815void
790loop_destroy (EV_P) 816loop_destroy (EV_P)
791{ 817{
792 int i; 818 int i;
793 819
820#if EV_USE_PORT
821 if (method == EVMETHOD_PORT ) port_destroy (EV_A);
822#endif
794#if EV_USE_KQUEUE 823#if EV_USE_KQUEUE
795 if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); 824 if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A);
796#endif 825#endif
797#if EV_USE_EPOLL 826#if EV_USE_EPOLL
798 if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A); 827 if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A);
806 835
807 for (i = NUMPRI; i--; ) 836 for (i = NUMPRI; i--; )
808 array_free (pending, [i]); 837 array_free (pending, [i]);
809 838
810 /* have to use the microsoft-never-gets-it-right macro */ 839 /* have to use the microsoft-never-gets-it-right macro */
811 array_free (fdchange, EMPTY); 840 array_free (fdchange, EMPTY0);
812 array_free (timer, EMPTY); 841 array_free (timer, EMPTY0);
813#if EV_PERIODICS 842#if EV_PERIODICS
814 array_free (periodic, EMPTY); 843 array_free (periodic, EMPTY0);
815#endif 844#endif
816 array_free (idle, EMPTY); 845 array_free (idle, EMPTY0);
817 array_free (prepare, EMPTY); 846 array_free (prepare, EMPTY0);
818 array_free (check, EMPTY); 847 array_free (check, EMPTY0);
819 848
820 method = 0; 849 method = 0;
821} 850}
822 851
823static void 852static void
824loop_fork (EV_P) 853loop_fork (EV_P)
825{ 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
826#if EV_USE_EPOLL 861#if EV_USE_EPOLL
827 if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A); 862 if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A);
828#endif
829#if EV_USE_KQUEUE
830 if (method == EVMETHOD_KQUEUE) kqueue_fork (EV_A);
831#endif 863#endif
832 864
833 if (ev_is_active (&sigev)) 865 if (ev_is_active (&sigev))
834 { 866 {
835 /* default loop */ 867 /* default loop */
848 postfork = 0; 880 postfork = 0;
849} 881}
850 882
851#if EV_MULTIPLICITY 883#if EV_MULTIPLICITY
852struct ev_loop * 884struct ev_loop *
853ev_loop_new (int methods) 885ev_loop_new (unsigned int flags)
854{ 886{
855 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));
856 888
857 memset (loop, 0, sizeof (struct ev_loop)); 889 memset (loop, 0, sizeof (struct ev_loop));
858 890
859 loop_init (EV_A_ methods); 891 loop_init (EV_A_ flags);
860 892
861 if (ev_method (EV_A)) 893 if (ev_method (EV_A))
862 return loop; 894 return loop;
863 895
864 return 0; 896 return 0;
879 911
880#endif 912#endif
881 913
882#if EV_MULTIPLICITY 914#if EV_MULTIPLICITY
883struct ev_loop * 915struct ev_loop *
916ev_default_loop_ (unsigned int flags)
884#else 917#else
885int 918int
919ev_default_loop (unsigned int flags)
886#endif 920#endif
887ev_default_loop (int methods)
888{ 921{
889 if (sigpipe [0] == sigpipe [1]) 922 if (sigpipe [0] == sigpipe [1])
890 if (pipe (sigpipe)) 923 if (pipe (sigpipe))
891 return 0; 924 return 0;
892 925
893 if (!default_loop) 926 if (!ev_default_loop_ptr)
894 { 927 {
895#if EV_MULTIPLICITY 928#if EV_MULTIPLICITY
896 struct ev_loop *loop = default_loop = &default_loop_struct; 929 struct ev_loop *loop = ev_default_loop_ptr = &default_loop_struct;
897#else 930#else
898 default_loop = 1; 931 ev_default_loop_ptr = 1;
899#endif 932#endif
900 933
901 loop_init (EV_A_ methods); 934 loop_init (EV_A_ flags);
902 935
903 if (ev_method (EV_A)) 936 if (ev_method (EV_A))
904 { 937 {
905 siginit (EV_A); 938 siginit (EV_A);
906 939
910 ev_signal_start (EV_A_ &childev); 943 ev_signal_start (EV_A_ &childev);
911 ev_unref (EV_A); /* child watcher should not keep loop alive */ 944 ev_unref (EV_A); /* child watcher should not keep loop alive */
912#endif 945#endif
913 } 946 }
914 else 947 else
915 default_loop = 0; 948 ev_default_loop_ptr = 0;
916 } 949 }
917 950
918 return default_loop; 951 return ev_default_loop_ptr;
919} 952}
920 953
921void 954void
922ev_default_destroy (void) 955ev_default_destroy (void)
923{ 956{
924#if EV_MULTIPLICITY 957#if EV_MULTIPLICITY
925 struct ev_loop *loop = default_loop; 958 struct ev_loop *loop = ev_default_loop_ptr;
926#endif 959#endif
927 960
928#ifndef _WIN32 961#ifndef _WIN32
929 ev_ref (EV_A); /* child watcher */ 962 ev_ref (EV_A); /* child watcher */
930 ev_signal_stop (EV_A_ &childev); 963 ev_signal_stop (EV_A_ &childev);
941 974
942void 975void
943ev_default_fork (void) 976ev_default_fork (void)
944{ 977{
945#if EV_MULTIPLICITY 978#if EV_MULTIPLICITY
946 struct ev_loop *loop = default_loop; 979 struct ev_loop *loop = ev_default_loop_ptr;
947#endif 980#endif
948 981
949 if (method) 982 if (method)
950 postfork = 1; 983 postfork = 1;
951} 984}
1020 assert (("inactive timer on periodic heap detected", ev_is_active (w))); 1053 assert (("inactive timer on periodic heap detected", ev_is_active (w)));
1021 1054
1022 /* first reschedule or stop timer */ 1055 /* first reschedule or stop timer */
1023 if (w->reschedule_cb) 1056 if (w->reschedule_cb)
1024 { 1057 {
1025 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);
1026
1027 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));
1028 downheap ((WT *)periodics, periodiccnt, 0); 1060 downheap ((WT *)periodics, periodiccnt, 0);
1029 } 1061 }
1030 else if (w->interval) 1062 else if (w->interval)
1031 { 1063 {
1149ev_loop (EV_P_ int flags) 1181ev_loop (EV_P_ int flags)
1150{ 1182{
1151 double block; 1183 double block;
1152 loop_done = flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK) ? 1 : 0; 1184 loop_done = flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK) ? 1 : 0;
1153 1185
1154 do 1186 while (activecnt)
1155 { 1187 {
1156 /* queue check watchers (and execute them) */ 1188 /* queue check watchers (and execute them) */
1157 if (expect_false (preparecnt)) 1189 if (expect_false (preparecnt))
1158 { 1190 {
1159 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); 1191 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE);
1222 /* queue check watchers, to be executed first */ 1254 /* queue check watchers, to be executed first */
1223 if (checkcnt) 1255 if (checkcnt)
1224 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); 1256 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK);
1225 1257
1226 call_pending (EV_A); 1258 call_pending (EV_A);
1259
1260 if (loop_done)
1261 break;
1227 } 1262 }
1228 while (activecnt && !loop_done);
1229 1263
1230 if (loop_done != 2) 1264 if (loop_done != 2)
1231 loop_done = 0; 1265 loop_done = 0;
1232} 1266}
1233 1267
1331 ((WT)w)->at += mn_now; 1365 ((WT)w)->at += mn_now;
1332 1366
1333 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.));
1334 1368
1335 ev_start (EV_A_ (W)w, ++timercnt); 1369 ev_start (EV_A_ (W)w, ++timercnt);
1336 array_needsize (struct ev_timer *, timers, timermax, timercnt, (void)); 1370 array_needsize (struct ev_timer *, timers, timermax, timercnt, EMPTY2);
1337 timers [timercnt - 1] = w; 1371 timers [timercnt - 1] = w;
1338 upheap ((WT *)timers, timercnt - 1); 1372 upheap ((WT *)timers, timercnt - 1);
1339 1373
1340 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); 1374 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));
1341} 1375}
1372 } 1406 }
1373 else 1407 else
1374 ev_timer_stop (EV_A_ w); 1408 ev_timer_stop (EV_A_ w);
1375 } 1409 }
1376 else if (w->repeat) 1410 else if (w->repeat)
1411 {
1412 w->at = w->repeat;
1377 ev_timer_start (EV_A_ w); 1413 ev_timer_start (EV_A_ w);
1414 }
1378} 1415}
1379 1416
1380#if EV_PERIODICS 1417#if EV_PERIODICS
1381void 1418void
1382ev_periodic_start (EV_P_ struct ev_periodic *w) 1419ev_periodic_start (EV_P_ struct ev_periodic *w)
1392 /* 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 */
1393 ((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;
1394 } 1431 }
1395 1432
1396 ev_start (EV_A_ (W)w, ++periodiccnt); 1433 ev_start (EV_A_ (W)w, ++periodiccnt);
1397 array_needsize (struct ev_periodic *, periodics, periodicmax, periodiccnt, (void)); 1434 array_needsize (struct ev_periodic *, periodics, periodicmax, periodiccnt, EMPTY2);
1398 periodics [periodiccnt - 1] = w; 1435 periodics [periodiccnt - 1] = w;
1399 upheap ((WT *)periodics, periodiccnt - 1); 1436 upheap ((WT *)periodics, periodiccnt - 1);
1400 1437
1401 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); 1438 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));
1402} 1439}
1433{ 1470{
1434 if (ev_is_active (w)) 1471 if (ev_is_active (w))
1435 return; 1472 return;
1436 1473
1437 ev_start (EV_A_ (W)w, ++idlecnt); 1474 ev_start (EV_A_ (W)w, ++idlecnt);
1438 array_needsize (struct ev_idle *, idles, idlemax, idlecnt, (void)); 1475 array_needsize (struct ev_idle *, idles, idlemax, idlecnt, EMPTY2);
1439 idles [idlecnt - 1] = w; 1476 idles [idlecnt - 1] = w;
1440} 1477}
1441 1478
1442void 1479void
1443ev_idle_stop (EV_P_ struct ev_idle *w) 1480ev_idle_stop (EV_P_ struct ev_idle *w)
1455{ 1492{
1456 if (ev_is_active (w)) 1493 if (ev_is_active (w))
1457 return; 1494 return;
1458 1495
1459 ev_start (EV_A_ (W)w, ++preparecnt); 1496 ev_start (EV_A_ (W)w, ++preparecnt);
1460 array_needsize (struct ev_prepare *, prepares, preparemax, preparecnt, (void)); 1497 array_needsize (struct ev_prepare *, prepares, preparemax, preparecnt, EMPTY2);
1461 prepares [preparecnt - 1] = w; 1498 prepares [preparecnt - 1] = w;
1462} 1499}
1463 1500
1464void 1501void
1465ev_prepare_stop (EV_P_ struct ev_prepare *w) 1502ev_prepare_stop (EV_P_ struct ev_prepare *w)
1477{ 1514{
1478 if (ev_is_active (w)) 1515 if (ev_is_active (w))
1479 return; 1516 return;
1480 1517
1481 ev_start (EV_A_ (W)w, ++checkcnt); 1518 ev_start (EV_A_ (W)w, ++checkcnt);
1482 array_needsize (struct ev_check *, checks, checkmax, checkcnt, (void)); 1519 array_needsize (struct ev_check *, checks, checkmax, checkcnt, EMPTY2);
1483 checks [checkcnt - 1] = w; 1520 checks [checkcnt - 1] = w;
1484} 1521}
1485 1522
1486void 1523void
1487ev_check_stop (EV_P_ struct ev_check *w) 1524ev_check_stop (EV_P_ struct ev_check *w)
1500 1537
1501void 1538void
1502ev_signal_start (EV_P_ struct ev_signal *w) 1539ev_signal_start (EV_P_ struct ev_signal *w)
1503{ 1540{
1504#if EV_MULTIPLICITY 1541#if EV_MULTIPLICITY
1505 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));
1506#endif 1543#endif
1507 if (ev_is_active (w)) 1544 if (ev_is_active (w))
1508 return; 1545 return;
1509 1546
1510 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));
1543 1580
1544void 1581void
1545ev_child_start (EV_P_ struct ev_child *w) 1582ev_child_start (EV_P_ struct ev_child *w)
1546{ 1583{
1547#if EV_MULTIPLICITY 1584#if EV_MULTIPLICITY
1548 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));
1549#endif 1586#endif
1550 if (ev_is_active (w)) 1587 if (ev_is_active (w))
1551 return; 1588 return;
1552 1589
1553 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