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

Comparing libev/ev.c (file contents):
Revision 1.509 by root, Sat Aug 17 05:30:16 2019 UTC vs.
Revision 1.520 by root, Sat Dec 28 07:44:15 2019 UTC

117# define EV_USE_EPOLL 0 117# define EV_USE_EPOLL 0
118# endif 118# endif
119 119
120# if HAVE_LINUX_AIO_ABI_H 120# if HAVE_LINUX_AIO_ABI_H
121# ifndef EV_USE_LINUXAIO 121# ifndef EV_USE_LINUXAIO
122# define EV_USE_LINUXAIO EV_FEATURE_BACKENDS 122# define EV_USE_LINUXAIO 0 /* was: EV_FEATURE_BACKENDS, always off by default */
123# endif 123# endif
124# else 124# else
125# undef EV_USE_LINUXAIO 125# undef EV_USE_LINUXAIO
126# define EV_USE_LINUXAIO 0 126# define EV_USE_LINUXAIO 0
127# endif 127# endif
128 128
129# if HAVE_LINUX_FS_H && HAVE_SYS_TIMERFD_H && HAVE_KERNEL_RWF_T
130# ifndef EV_USE_IOURING
131# define EV_USE_IOURING EV_FEATURE_BACKENDS
132# endif
133# else
134# undef EV_USE_IOURING
135# define EV_USE_IOURING 0
136# endif
137
129# if HAVE_KQUEUE && HAVE_SYS_EVENT_H 138# if HAVE_KQUEUE && HAVE_SYS_EVENT_H
130# ifndef EV_USE_KQUEUE 139# ifndef EV_USE_KQUEUE
131# define EV_USE_KQUEUE EV_FEATURE_BACKENDS 140# define EV_USE_KQUEUE EV_FEATURE_BACKENDS
132# endif 141# endif
133# else 142# else
168# endif 177# endif
169# else 178# else
170# undef EV_USE_EVENTFD 179# undef EV_USE_EVENTFD
171# define EV_USE_EVENTFD 0 180# define EV_USE_EVENTFD 0
172# endif 181# endif
173 182
183# if HAVE_SYS_TIMERFD_H
184# ifndef EV_USE_TIMERFD
185# define EV_USE_TIMERFD EV_FEATURE_OS
186# endif
187# else
188# undef EV_USE_TIMERFD
189# define EV_USE_TIMERFD 0
190# endif
191
174#endif 192#endif
175 193
176/* OS X, in its infinite idiocy, actually HARDCODES 194/* OS X, in its infinite idiocy, actually HARDCODES
177 * a limit of 1024 into their select. Where people have brains, 195 * a limit of 1024 into their select. Where people have brains,
178 * OS X engineers apparently have a vacuum. Or maybe they were 196 * OS X engineers apparently have a vacuum. Or maybe they were
326# define EV_USE_PORT 0 344# define EV_USE_PORT 0
327#endif 345#endif
328 346
329#ifndef EV_USE_LINUXAIO 347#ifndef EV_USE_LINUXAIO
330# if __linux /* libev currently assumes linux/aio_abi.h is always available on linux */ 348# if __linux /* libev currently assumes linux/aio_abi.h is always available on linux */
331# define EV_USE_LINUXAIO 1 349# define EV_USE_LINUXAIO 0 /* was: 1, always off by default */
332# else 350# else
333# define EV_USE_LINUXAIO 0 351# define EV_USE_LINUXAIO 0
334# endif 352# endif
335#endif 353#endif
336 354
337#ifndef EV_USE_IOURING 355#ifndef EV_USE_IOURING
338# if __linux 356# if __linux /* later checks might disable again */
339# define EV_USE_IOURING 0 357# define EV_USE_IOURING 1
340# else 358# else
341# define EV_USE_IOURING 0 359# define EV_USE_IOURING 0
342# endif 360# endif
343#endif 361#endif
344 362
369#ifndef EV_USE_SIGNALFD 387#ifndef EV_USE_SIGNALFD
370# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) 388# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
371# define EV_USE_SIGNALFD EV_FEATURE_OS 389# define EV_USE_SIGNALFD EV_FEATURE_OS
372# else 390# else
373# define EV_USE_SIGNALFD 0 391# define EV_USE_SIGNALFD 0
392# endif
393#endif
394
395#ifndef EV_USE_TIMERFD
396# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8))
397# define EV_USE_TIMERFD EV_FEATURE_OS
398# else
399# define EV_USE_TIMERFD 0
374# endif 400# endif
375#endif 401#endif
376 402
377#if 0 /* debugging */ 403#if 0 /* debugging */
378# define EV_VERIFY 3 404# define EV_VERIFY 3
438#if !EV_STAT_ENABLE 464#if !EV_STAT_ENABLE
439# undef EV_USE_INOTIFY 465# undef EV_USE_INOTIFY
440# define EV_USE_INOTIFY 0 466# define EV_USE_INOTIFY 0
441#endif 467#endif
442 468
469#if __linux && EV_USE_IOURING
470# include <linux/version.h>
471# if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
472# undef EV_USE_IOURING
473# define EV_USE_IOURING 0
474# endif
475#endif
476
443#if !EV_USE_NANOSLEEP 477#if !EV_USE_NANOSLEEP
444/* hp-ux has it in sys/time.h, which we unconditionally include above */ 478/* hp-ux has it in sys/time.h, which we unconditionally include above */
445# if !defined _WIN32 && !defined __hpux 479# if !defined _WIN32 && !defined __hpux
446# include <sys/select.h> 480# include <sys/select.h>
447# endif 481# endif
481# define EV_USE_INOTIFY 0 515# define EV_USE_INOTIFY 0
482# endif 516# endif
483#endif 517#endif
484 518
485#if EV_USE_EVENTFD 519#if EV_USE_EVENTFD
486/* our minimum requirement is glibc 2.7 which has the stub, but not the header */ 520/* our minimum requirement is glibc 2.7 which has the stub, but not the full header */
487# include <stdint.h> 521# include <stdint.h>
488# ifndef EFD_NONBLOCK 522# ifndef EFD_NONBLOCK
489# define EFD_NONBLOCK O_NONBLOCK 523# define EFD_NONBLOCK O_NONBLOCK
490# endif 524# endif
491# ifndef EFD_CLOEXEC 525# ifndef EFD_CLOEXEC
497# endif 531# endif
498EV_CPP(extern "C") int (eventfd) (unsigned int initval, int flags); 532EV_CPP(extern "C") int (eventfd) (unsigned int initval, int flags);
499#endif 533#endif
500 534
501#if EV_USE_SIGNALFD 535#if EV_USE_SIGNALFD
502/* our minimum requirement is glibc 2.7 which has the stub, but not the header */ 536/* our minimum requirement is glibc 2.7 which has the stub, but not the full header */
503# include <stdint.h> 537# include <stdint.h>
504# ifndef SFD_NONBLOCK 538# ifndef SFD_NONBLOCK
505# define SFD_NONBLOCK O_NONBLOCK 539# define SFD_NONBLOCK O_NONBLOCK
506# endif 540# endif
507# ifndef SFD_CLOEXEC 541# ifndef SFD_CLOEXEC
509# define SFD_CLOEXEC O_CLOEXEC 543# define SFD_CLOEXEC O_CLOEXEC
510# else 544# else
511# define SFD_CLOEXEC 02000000 545# define SFD_CLOEXEC 02000000
512# endif 546# endif
513# endif 547# endif
514EV_CPP (extern "C") int signalfd (int fd, const sigset_t *mask, int flags); 548EV_CPP (extern "C") int (signalfd) (int fd, const sigset_t *mask, int flags);
515 549
516struct signalfd_siginfo 550struct signalfd_siginfo
517{ 551{
518 uint32_t ssi_signo; 552 uint32_t ssi_signo;
519 char pad[128 - sizeof (uint32_t)]; 553 char pad[128 - sizeof (uint32_t)];
520}; 554};
555#endif
556
557/* for timerfd, libev core requires TFD_TIMER_CANCEL_ON_SET &c */
558#if EV_USE_TIMERFD
559# include <sys/timerfd.h>
560/* timerfd is only used for periodics */
561# if !(defined (TFD_TIMER_CANCEL_ON_SET) && defined (TFD_CLOEXEC) && defined (TFD_NONBLOCK)) || !EV_PERIODIC_ENABLE
562# undef EV_USE_TIMERFD
563# define EV_USE_TIMERFD 0
564# endif
521#endif 565#endif
522 566
523/*****************************************************************************/ 567/*****************************************************************************/
524 568
525#if EV_VERIFY >= 3 569#if EV_VERIFY >= 3
1614 * our syscalls return < 0, not == -1, on error. which is good 1658 * our syscalls return < 0, not == -1, on error. which is good
1615 * enough for linux aio. 1659 * enough for linux aio.
1616 * TODO: arm is also common nowadays, maybe even mips and x86 1660 * TODO: arm is also common nowadays, maybe even mips and x86
1617 * TODO: after implementing this, it suddenly looks like overkill, but its hard to remove... 1661 * TODO: after implementing this, it suddenly looks like overkill, but its hard to remove...
1618 */ 1662 */
1619#if __GNUC__ && __linux && ECB_AMD64 && !defined __OPTIMIZE_SIZE__ 1663#if __GNUC__ && __linux && ECB_AMD64 && !EV_FEATURE_CODE
1620 /* the costly errno access probably kills this for size optimisation */ 1664 /* the costly errno access probably kills this for size optimisation */
1621 1665
1622 #define ev_syscall(nr,narg,arg1,arg2,arg3,arg4,arg5,arg6) \ 1666 #define ev_syscall(nr,narg,arg1,arg2,arg3,arg4,arg5,arg6) \
1623 ({ \ 1667 ({ \
1624 long res; \ 1668 long res; \
2004 clock_gettime (CLOCK_REALTIME, &ts); 2048 clock_gettime (CLOCK_REALTIME, &ts);
2005 return EV_TS_GET (ts); 2049 return EV_TS_GET (ts);
2006 } 2050 }
2007#endif 2051#endif
2008 2052
2053 {
2009 struct timeval tv; 2054 struct timeval tv;
2010 gettimeofday (&tv, 0); 2055 gettimeofday (&tv, 0);
2011 return EV_TV_GET (tv); 2056 return EV_TV_GET (tv);
2057 }
2012} 2058}
2013#endif 2059#endif
2014 2060
2015inline_size ev_tstamp 2061inline_size ev_tstamp
2016get_clock (void) 2062get_clock (void)
2216inline_size void 2262inline_size void
2217fd_reify (EV_P) 2263fd_reify (EV_P)
2218{ 2264{
2219 int i; 2265 int i;
2220 2266
2267 /* most backends do not modify the fdchanges list in backend_modfiy.
2268 * except io_uring, which has fixed-size buffers which might force us
2269 * to handle events in backend_modify, causing fdchangesd to be amended,
2270 * which could result in an endless loop.
2271 * to avoid this, we do not dynamically handle fds that were added
2272 * during fd_reify. that menas thast for those backends, fdchangecnt
2273 * might be non-zero during poll, which must cause them to not block.
2274 * to not put too much of a burden on other backends, this detail
2275 * needs to be handled in the backend.
2276 */
2277 int changecnt = fdchangecnt;
2278
2221#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP 2279#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
2222 for (i = 0; i < fdchangecnt; ++i) 2280 for (i = 0; i < changecnt; ++i)
2223 { 2281 {
2224 int fd = fdchanges [i]; 2282 int fd = fdchanges [i];
2225 ANFD *anfd = anfds + fd; 2283 ANFD *anfd = anfds + fd;
2226 2284
2227 if (anfd->reify & EV__IOFDSET && anfd->head) 2285 if (anfd->reify & EV__IOFDSET && anfd->head)
2241 } 2299 }
2242 } 2300 }
2243 } 2301 }
2244#endif 2302#endif
2245 2303
2246 for (i = 0; i < fdchangecnt; ++i) 2304 for (i = 0; i < changecnt; ++i)
2247 { 2305 {
2248 int fd = fdchanges [i]; 2306 int fd = fdchanges [i];
2249 ANFD *anfd = anfds + fd; 2307 ANFD *anfd = anfds + fd;
2250 ev_io *w; 2308 ev_io *w;
2251 2309
2267 2325
2268 if (o_reify & EV__IOFDSET) 2326 if (o_reify & EV__IOFDSET)
2269 backend_modify (EV_A_ fd, o_events, anfd->events); 2327 backend_modify (EV_A_ fd, o_events, anfd->events);
2270 } 2328 }
2271 2329
2330 /* normally, fdchangecnt hasn't changed. if it has, then new fds have been added.
2331 * this is a rare case (see beginning comment in this function), so we copy them to the
2332 * front and hope the backend handles this case.
2333 */
2334 if (ecb_expect_false (fdchangecnt != changecnt))
2335 memmove (fdchanges, fdchanges + changecnt, (fdchangecnt - changecnt) * sizeof (*fdchanges));
2336
2272 fdchangecnt = 0; 2337 fdchangecnt -= changecnt;
2273} 2338}
2274 2339
2275/* something about the given fd changed */ 2340/* something about the given fd changed */
2276inline_size 2341inline_size
2277void 2342void
2829 2894
2830#endif 2895#endif
2831 2896
2832/*****************************************************************************/ 2897/*****************************************************************************/
2833 2898
2899#if EV_USE_TIMERFD
2900
2901static void periodics_reschedule (EV_P);
2902
2903static void
2904timerfdcb (EV_P_ ev_io *iow, int revents)
2905{
2906 struct itimerspec its = { 0 };
2907
2908 /* since we can't easily come zup with a (portable) maximum value of time_t,
2909 * we wake up once per month, which hopefully is rare enough to not
2910 * be a problem. */
2911 its.it_value.tv_sec = ev_rt_now + 86400 * 30;
2912 timerfd_settime (timerfd, TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET, &its, 0);
2913
2914 ev_rt_now = ev_time ();
2915 /* periodics_reschedule only needs ev_rt_now */
2916 /* but maybe in the future we want the full treatment. */
2917 /*
2918 now_floor = EV_TS_CONST (0.);
2919 time_update (EV_A_ EV_TSTAMP_HUGE);
2920 */
2921 periodics_reschedule (EV_A);
2922}
2923
2924ecb_noinline ecb_cold
2925static void
2926evtimerfd_init (EV_P)
2927{
2928 if (!ev_is_active (&timerfd_w))
2929 {
2930 timerfd = timerfd_create (CLOCK_REALTIME, TFD_NONBLOCK | TFD_CLOEXEC);
2931
2932 if (timerfd >= 0)
2933 {
2934 fd_intern (timerfd); /* just to be sure */
2935
2936 ev_io_init (&timerfd_w, timerfdcb, timerfd, EV_READ);
2937 ev_set_priority (&timerfd_w, EV_MINPRI);
2938 ev_io_start (EV_A_ &timerfd_w);
2939 ev_unref (EV_A); /* watcher should not keep loop alive */
2940
2941 /* (re-) arm timer */
2942 timerfdcb (EV_A_ 0, 0);
2943 }
2944 }
2945}
2946
2947#endif
2948
2949/*****************************************************************************/
2950
2834#if EV_USE_IOCP 2951#if EV_USE_IOCP
2835# include "ev_iocp.c" 2952# include "ev_iocp.c"
2836#endif 2953#endif
2837#if EV_USE_PORT 2954#if EV_USE_PORT
2838# include "ev_port.c" 2955# include "ev_port.c"
2884unsigned int 3001unsigned int
2885ev_supported_backends (void) EV_NOEXCEPT 3002ev_supported_backends (void) EV_NOEXCEPT
2886{ 3003{
2887 unsigned int flags = 0; 3004 unsigned int flags = 0;
2888 3005
2889 if (EV_USE_PORT ) flags |= EVBACKEND_PORT; 3006 if (EV_USE_PORT ) flags |= EVBACKEND_PORT;
2890 if (EV_USE_KQUEUE ) flags |= EVBACKEND_KQUEUE; 3007 if (EV_USE_KQUEUE ) flags |= EVBACKEND_KQUEUE;
2891 if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL; 3008 if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL;
2892 if (EV_USE_LINUXAIO) flags |= EVBACKEND_LINUXAIO; 3009 if (EV_USE_LINUXAIO ) flags |= EVBACKEND_LINUXAIO;
2893 if (EV_USE_IOURING ) flags |= EVBACKEND_IOURING; 3010 if (EV_USE_IOURING && ev_linux_version () >= 0x050601) flags |= EVBACKEND_IOURING; /* 5.6.1+ */
2894 if (EV_USE_POLL ) flags |= EVBACKEND_POLL; 3011 if (EV_USE_POLL ) flags |= EVBACKEND_POLL;
2895 if (EV_USE_SELECT ) flags |= EVBACKEND_SELECT; 3012 if (EV_USE_SELECT ) flags |= EVBACKEND_SELECT;
2896 3013
2897 return flags; 3014 return flags;
2898} 3015}
2899 3016
2900ecb_cold 3017ecb_cold
2901unsigned int 3018unsigned int
3070 fs_fd = flags & EVFLAG_NOINOTIFY ? -1 : -2; 3187 fs_fd = flags & EVFLAG_NOINOTIFY ? -1 : -2;
3071#endif 3188#endif
3072#if EV_USE_SIGNALFD 3189#if EV_USE_SIGNALFD
3073 sigfd = flags & EVFLAG_SIGNALFD ? -2 : -1; 3190 sigfd = flags & EVFLAG_SIGNALFD ? -2 : -1;
3074#endif 3191#endif
3192#if EV_USE_TIMERFD
3193 timerfd = flags & EVFLAG_NOTIMERFD ? -1 : -2;
3194#endif
3075 3195
3076 if (!(flags & EVBACKEND_MASK)) 3196 if (!(flags & EVBACKEND_MASK))
3077 flags |= ev_recommended_backends (); 3197 flags |= ev_recommended_backends ();
3078 3198
3079#if EV_USE_IOCP 3199#if EV_USE_IOCP
3150 } 3270 }
3151 3271
3152#if EV_USE_SIGNALFD 3272#if EV_USE_SIGNALFD
3153 if (ev_is_active (&sigfd_w)) 3273 if (ev_is_active (&sigfd_w))
3154 close (sigfd); 3274 close (sigfd);
3275#endif
3276
3277#if EV_USE_TIMERFD
3278 if (ev_is_active (&timerfd_w))
3279 close (timerfd);
3155#endif 3280#endif
3156 3281
3157#if EV_USE_INOTIFY 3282#if EV_USE_INOTIFY
3158 if (fs_fd >= 0) 3283 if (fs_fd >= 0)
3159 close (fs_fd); 3284 close (fs_fd);
3252#endif 3377#endif
3253#if EV_USE_INOTIFY 3378#if EV_USE_INOTIFY
3254 infy_fork (EV_A); 3379 infy_fork (EV_A);
3255#endif 3380#endif
3256 3381
3382 if (postfork != 2)
3383 {
3384 #if EV_USE_SIGNALFD
3385 /* surprisingly, nothing needs to be done for signalfd, accoridng to docs, it does the right thing on fork */
3386 #endif
3387
3388 #if EV_USE_TIMERFD
3389 if (ev_is_active (&timerfd_w))
3390 {
3391 ev_ref (EV_A);
3392 ev_io_stop (EV_A_ &timerfd_w);
3393
3394 close (timerfd);
3395 timerfd = -2;
3396
3397 evtimerfd_init (EV_A);
3398 /* reschedule periodics, in case we missed something */
3399 ev_feed_event (EV_A_ &timerfd_w, EV_CUSTOM);
3400 }
3401 #endif
3402
3257#if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE 3403 #if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE
3258 if (ev_is_active (&pipe_w) && postfork != 2) 3404 if (ev_is_active (&pipe_w))
3259 { 3405 {
3260 /* pipe_write_wanted must be false now, so modifying fd vars should be safe */ 3406 /* pipe_write_wanted must be false now, so modifying fd vars should be safe */
3261 3407
3262 ev_ref (EV_A); 3408 ev_ref (EV_A);
3263 ev_io_stop (EV_A_ &pipe_w); 3409 ev_io_stop (EV_A_ &pipe_w);
3264 3410
3265 if (evpipe [0] >= 0) 3411 if (evpipe [0] >= 0)
3266 EV_WIN32_CLOSE_FD (evpipe [0]); 3412 EV_WIN32_CLOSE_FD (evpipe [0]);
3267 3413
3268 evpipe_init (EV_A); 3414 evpipe_init (EV_A);
3269 /* iterate over everything, in case we missed something before */ 3415 /* iterate over everything, in case we missed something before */
3270 ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM); 3416 ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM);
3417 }
3418 #endif
3271 } 3419 }
3272#endif
3273 3420
3274 postfork = 0; 3421 postfork = 0;
3275} 3422}
3276 3423
3277#if EV_MULTIPLICITY 3424#if EV_MULTIPLICITY
3839 3986
3840 /* don't let timeouts decrease the waittime below timeout_blocktime */ 3987 /* don't let timeouts decrease the waittime below timeout_blocktime */
3841 if (ecb_expect_false (waittime < timeout_blocktime)) 3988 if (ecb_expect_false (waittime < timeout_blocktime))
3842 waittime = timeout_blocktime; 3989 waittime = timeout_blocktime;
3843 3990
3844 /* at this point, we NEED to wait, so we have to ensure */ 3991 /* now there are two more special cases left, either we have
3845 /* to pass a minimum nonzero value to the backend */ 3992 * already-expired timers, so we should not sleep, or we have timers
3993 * that expire very soon, in which case we need to wait for a minimum
3994 * amount of time for some event loop backends.
3995 */
3846 if (ecb_expect_false (waittime < backend_mintime)) 3996 if (ecb_expect_false (waittime < backend_mintime))
3997 waittime = waittime <= EV_TS_CONST (0.)
3998 ? EV_TS_CONST (0.)
3847 waittime = backend_mintime; 3999 : backend_mintime;
3848 4000
3849 /* extra check because io_blocktime is commonly 0 */ 4001 /* extra check because io_blocktime is commonly 0 */
3850 if (ecb_expect_false (io_blocktime)) 4002 if (ecb_expect_false (io_blocktime))
3851 { 4003 {
3852 sleeptime = io_blocktime - (mn_now - prev_mn_now); 4004 sleeptime = io_blocktime - (mn_now - prev_mn_now);
4187void 4339void
4188ev_periodic_start (EV_P_ ev_periodic *w) EV_NOEXCEPT 4340ev_periodic_start (EV_P_ ev_periodic *w) EV_NOEXCEPT
4189{ 4341{
4190 if (ecb_expect_false (ev_is_active (w))) 4342 if (ecb_expect_false (ev_is_active (w)))
4191 return; 4343 return;
4344
4345#if EV_USE_TIMERFD
4346 if (timerfd == -2)
4347 evtimerfd_init (EV_A);
4348#endif
4192 4349
4193 if (w->reschedule_cb) 4350 if (w->reschedule_cb)
4194 ev_at (w) = w->reschedule_cb (w, ev_rt_now); 4351 ev_at (w) = w->reschedule_cb (w, ev_rt_now);
4195 else if (w->interval) 4352 else if (w->interval)
4196 { 4353 {
4938 ev_run (EV_A_ EVRUN_NOWAIT); 5095 ev_run (EV_A_ EVRUN_NOWAIT);
4939 } 5096 }
4940 } 5097 }
4941} 5098}
4942 5099
5100#if EV_FORK_ENABLE
4943static void 5101static void
4944embed_fork_cb (EV_P_ ev_fork *fork_w, int revents) 5102embed_fork_cb (EV_P_ ev_fork *fork_w, int revents)
4945{ 5103{
4946 ev_embed *w = (ev_embed *)(((char *)fork_w) - offsetof (ev_embed, fork)); 5104 ev_embed *w = (ev_embed *)(((char *)fork_w) - offsetof (ev_embed, fork));
4947 5105
4954 ev_run (EV_A_ EVRUN_NOWAIT); 5112 ev_run (EV_A_ EVRUN_NOWAIT);
4955 } 5113 }
4956 5114
4957 ev_embed_start (EV_A_ w); 5115 ev_embed_start (EV_A_ w);
4958} 5116}
5117#endif
4959 5118
4960#if 0 5119#if 0
4961static void 5120static void
4962embed_idle_cb (EV_P_ ev_idle *idle, int revents) 5121embed_idle_cb (EV_P_ ev_idle *idle, int revents)
4963{ 5122{
4984 5143
4985 ev_prepare_init (&w->prepare, embed_prepare_cb); 5144 ev_prepare_init (&w->prepare, embed_prepare_cb);
4986 ev_set_priority (&w->prepare, EV_MINPRI); 5145 ev_set_priority (&w->prepare, EV_MINPRI);
4987 ev_prepare_start (EV_A_ &w->prepare); 5146 ev_prepare_start (EV_A_ &w->prepare);
4988 5147
5148#if EV_FORK_ENABLE
4989 ev_fork_init (&w->fork, embed_fork_cb); 5149 ev_fork_init (&w->fork, embed_fork_cb);
4990 ev_fork_start (EV_A_ &w->fork); 5150 ev_fork_start (EV_A_ &w->fork);
5151#endif
4991 5152
4992 /*ev_idle_init (&w->idle, e,bed_idle_cb);*/ 5153 /*ev_idle_init (&w->idle, e,bed_idle_cb);*/
4993 5154
4994 ev_start (EV_A_ (W)w, 1); 5155 ev_start (EV_A_ (W)w, 1);
4995 5156
5005 5166
5006 EV_FREQUENT_CHECK; 5167 EV_FREQUENT_CHECK;
5007 5168
5008 ev_io_stop (EV_A_ &w->io); 5169 ev_io_stop (EV_A_ &w->io);
5009 ev_prepare_stop (EV_A_ &w->prepare); 5170 ev_prepare_stop (EV_A_ &w->prepare);
5171#if EV_FORK_ENABLE
5010 ev_fork_stop (EV_A_ &w->fork); 5172 ev_fork_stop (EV_A_ &w->fork);
5173#endif
5011 5174
5012 ev_stop (EV_A_ (W)w); 5175 ev_stop (EV_A_ (W)w);
5013 5176
5014 EV_FREQUENT_CHECK; 5177 EV_FREQUENT_CHECK;
5015} 5178}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines