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

Comparing libev/ev.c (file contents):
Revision 1.481 by root, Thu Jun 1 20:25:50 2017 UTC vs.
Revision 1.488 by root, Fri Dec 21 06:57:09 2018 UTC

1/* 1/*
2 * libev event processing core, watcher management 2 * libev event processing core, watcher management
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007-2018 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 *
162# define EV_USE_EVENTFD 0 162# define EV_USE_EVENTFD 0
163# endif 163# endif
164 164
165#endif 165#endif
166 166
167/* OS X, in its infinite idiocy, actually HARDCODES
168 * a limit of 1024 into their select. Where people have brains,
169 * OS X engineers apparently have a vacuum. Or maybe they were
170 * ordered to have a vacuum, or they do anything for money.
171 * This might help. Or not.
172 * Note that this must be defined early, as other include files
173 * will rely on this define as well.
174 */
175#define _DARWIN_UNLIMITED_SELECT 1
176
167#include <stdlib.h> 177#include <stdlib.h>
168#include <string.h> 178#include <string.h>
169#include <fcntl.h> 179#include <fcntl.h>
170#include <stddef.h> 180#include <stddef.h>
171 181
208# ifndef EV_SELECT_IS_WINSOCKET 218# ifndef EV_SELECT_IS_WINSOCKET
209# define EV_SELECT_IS_WINSOCKET 1 219# define EV_SELECT_IS_WINSOCKET 1
210# endif 220# endif
211# undef EV_AVOID_STDIO 221# undef EV_AVOID_STDIO
212#endif 222#endif
213
214/* OS X, in its infinite idiocy, actually HARDCODES
215 * a limit of 1024 into their select. Where people have brains,
216 * OS X engineers apparently have a vacuum. Or maybe they were
217 * ordered to have a vacuum, or they do anything for money.
218 * This might help. Or not.
219 */
220#define _DARWIN_UNLIMITED_SELECT 1
221 223
222/* this block tries to deduce configuration from header-defined symbols and defaults */ 224/* this block tries to deduce configuration from header-defined symbols and defaults */
223 225
224/* try to deduce the maximum number of signals on this platform */ 226/* try to deduce the maximum number of signals on this platform */
225#if defined EV_NSIG 227#if defined EV_NSIG
607 #define ECB_CLANG_EXTENSION(x) 0 609 #define ECB_CLANG_EXTENSION(x) 0
608#endif 610#endif
609 611
610#define ECB_CPP (__cplusplus+0) 612#define ECB_CPP (__cplusplus+0)
611#define ECB_CPP11 (__cplusplus >= 201103L) 613#define ECB_CPP11 (__cplusplus >= 201103L)
614#define ECB_CPP14 (__cplusplus >= 201402L)
615#define ECB_CPP17 (__cplusplus >= 201703L)
612 616
613#if ECB_CPP 617#if ECB_CPP
614 #define ECB_C 0 618 #define ECB_C 0
615 #define ECB_STDC_VERSION 0 619 #define ECB_STDC_VERSION 0
616#else 620#else
618 #define ECB_STDC_VERSION __STDC_VERSION__ 622 #define ECB_STDC_VERSION __STDC_VERSION__
619#endif 623#endif
620 624
621#define ECB_C99 (ECB_STDC_VERSION >= 199901L) 625#define ECB_C99 (ECB_STDC_VERSION >= 199901L)
622#define ECB_C11 (ECB_STDC_VERSION >= 201112L) 626#define ECB_C11 (ECB_STDC_VERSION >= 201112L)
627#define ECB_C17 (ECB_STDC_VERSION >= 201710L)
623 628
624#if ECB_CPP 629#if ECB_CPP
625 #define ECB_EXTERN_C extern "C" 630 #define ECB_EXTERN_C extern "C"
626 #define ECB_EXTERN_C_BEG ECB_EXTERN_C { 631 #define ECB_EXTERN_C_BEG ECB_EXTERN_C {
627 #define ECB_EXTERN_C_END } 632 #define ECB_EXTERN_C_END }
656#ifndef ECB_MEMORY_FENCE 661#ifndef ECB_MEMORY_FENCE
657 #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 662 #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
658 #if __i386 || __i386__ 663 #if __i386 || __i386__
659 #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") 664 #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
660 #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") 665 #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
661 #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") 666 #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory")
662 #elif ECB_GCC_AMD64 667 #elif ECB_GCC_AMD64
663 #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") 668 #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
664 #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") 669 #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
665 #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") 670 #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory")
666 #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ 671 #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__
667 #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") 672 #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory")
668 #elif defined __ARM_ARCH_2__ \ 673 #elif defined __ARM_ARCH_2__ \
669 || defined __ARM_ARCH_3__ || defined __ARM_ARCH_3M__ \ 674 || defined __ARM_ARCH_3__ || defined __ARM_ARCH_3M__ \
670 || defined __ARM_ARCH_4__ || defined __ARM_ARCH_4T__ \ 675 || defined __ARM_ARCH_4__ || defined __ARM_ARCH_4T__ \
1675{ 1680{
1676 write (STDERR_FILENO, msg, strlen (msg)); 1681 write (STDERR_FILENO, msg, strlen (msg));
1677} 1682}
1678#endif 1683#endif
1679 1684
1680static void (*syserr_cb)(const char *msg) EV_THROW; 1685static void (*syserr_cb)(const char *msg) EV_NOEXCEPT;
1681 1686
1682ecb_cold 1687ecb_cold
1683void 1688void
1684ev_set_syserr_cb (void (*cb)(const char *msg) EV_THROW) EV_THROW 1689ev_set_syserr_cb (void (*cb)(const char *msg) EV_NOEXCEPT) EV_NOEXCEPT
1685{ 1690{
1686 syserr_cb = cb; 1691 syserr_cb = cb;
1687} 1692}
1688 1693
1689noinline ecb_cold 1694noinline ecb_cold
1708 abort (); 1713 abort ();
1709 } 1714 }
1710} 1715}
1711 1716
1712static void * 1717static void *
1713ev_realloc_emul (void *ptr, long size) EV_THROW 1718ev_realloc_emul (void *ptr, long size) EV_NOEXCEPT
1714{ 1719{
1715 /* some systems, notably openbsd and darwin, fail to properly 1720 /* some systems, notably openbsd and darwin, fail to properly
1716 * implement realloc (x, 0) (as required by both ansi c-89 and 1721 * implement realloc (x, 0) (as required by both ansi c-89 and
1717 * the single unix specification, so work around them here. 1722 * the single unix specification, so work around them here.
1718 * recently, also (at least) fedora and debian started breaking it, 1723 * recently, also (at least) fedora and debian started breaking it,
1724 1729
1725 free (ptr); 1730 free (ptr);
1726 return 0; 1731 return 0;
1727} 1732}
1728 1733
1729static void *(*alloc)(void *ptr, long size) EV_THROW = ev_realloc_emul; 1734static void *(*alloc)(void *ptr, long size) EV_NOEXCEPT = ev_realloc_emul;
1730 1735
1731ecb_cold 1736ecb_cold
1732void 1737void
1733ev_set_allocator (void *(*cb)(void *ptr, long size) EV_THROW) EV_THROW 1738ev_set_allocator (void *(*cb)(void *ptr, long size) EV_NOEXCEPT) EV_NOEXCEPT
1734{ 1739{
1735 alloc = cb; 1740 alloc = cb;
1736} 1741}
1737 1742
1738inline_speed void * 1743inline_speed void *
1855 1860
1856/*****************************************************************************/ 1861/*****************************************************************************/
1857 1862
1858#ifndef EV_HAVE_EV_TIME 1863#ifndef EV_HAVE_EV_TIME
1859ev_tstamp 1864ev_tstamp
1860ev_time (void) EV_THROW 1865ev_time (void) EV_NOEXCEPT
1861{ 1866{
1862#if EV_USE_REALTIME 1867#if EV_USE_REALTIME
1863 if (expect_true (have_realtime)) 1868 if (expect_true (have_realtime))
1864 { 1869 {
1865 struct timespec ts; 1870 struct timespec ts;
1889 return ev_time (); 1894 return ev_time ();
1890} 1895}
1891 1896
1892#if EV_MULTIPLICITY 1897#if EV_MULTIPLICITY
1893ev_tstamp 1898ev_tstamp
1894ev_now (EV_P) EV_THROW 1899ev_now (EV_P) EV_NOEXCEPT
1895{ 1900{
1896 return ev_rt_now; 1901 return ev_rt_now;
1897} 1902}
1898#endif 1903#endif
1899 1904
1900void 1905void
1901ev_sleep (ev_tstamp delay) EV_THROW 1906ev_sleep (ev_tstamp delay) EV_NOEXCEPT
1902{ 1907{
1903 if (delay > 0.) 1908 if (delay > 0.)
1904 { 1909 {
1905#if EV_USE_NANOSLEEP 1910#if EV_USE_NANOSLEEP
1906 struct timespec ts; 1911 struct timespec ts;
1907 1912
1908 EV_TS_SET (ts, delay); 1913 EV_TS_SET (ts, delay);
1909 nanosleep (&ts, 0); 1914 nanosleep (&ts, 0);
1910#elif defined _WIN32 1915#elif defined _WIN32
1916 /* maybe this should round up, as ms is very low resolution */
1917 /* compared to select (µs) or nanosleep (ns) */
1911 Sleep ((unsigned long)(delay * 1e3)); 1918 Sleep ((unsigned long)(delay * 1e3));
1912#else 1919#else
1913 struct timeval tv; 1920 struct timeval tv;
1914 1921
1915 /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */ 1922 /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */
1990{ 1997{
1991} 1998}
1992 1999
1993noinline 2000noinline
1994void 2001void
1995ev_feed_event (EV_P_ void *w, int revents) EV_THROW 2002ev_feed_event (EV_P_ void *w, int revents) EV_NOEXCEPT
1996{ 2003{
1997 W w_ = (W)w; 2004 W w_ = (W)w;
1998 int pri = ABSPRI (w_); 2005 int pri = ABSPRI (w_);
1999 2006
2000 if (expect_false (w_->pending)) 2007 if (expect_false (w_->pending))
2061 if (expect_true (!anfd->reify)) 2068 if (expect_true (!anfd->reify))
2062 fd_event_nocheck (EV_A_ fd, revents); 2069 fd_event_nocheck (EV_A_ fd, revents);
2063} 2070}
2064 2071
2065void 2072void
2066ev_feed_fd_event (EV_P_ int fd, int revents) EV_THROW 2073ev_feed_fd_event (EV_P_ int fd, int revents) EV_NOEXCEPT
2067{ 2074{
2068 if (fd >= 0 && fd < anfdmax) 2075 if (fd >= 0 && fd < anfdmax)
2069 fd_event_nocheck (EV_A_ fd, revents); 2076 fd_event_nocheck (EV_A_ fd, revents);
2070} 2077}
2071 2078
2471#endif 2478#endif
2472 { 2479 {
2473#ifdef _WIN32 2480#ifdef _WIN32
2474 WSABUF buf; 2481 WSABUF buf;
2475 DWORD sent; 2482 DWORD sent;
2476 buf.buf = &buf; 2483 buf.buf = (char *)&buf;
2477 buf.len = 1; 2484 buf.len = 1;
2478 WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0); 2485 WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0);
2479#else 2486#else
2480 write (evpipe [1], &(evpipe [1]), 1); 2487 write (evpipe [1], &(evpipe [1]), 1);
2481#endif 2488#endif
2553} 2560}
2554 2561
2555/*****************************************************************************/ 2562/*****************************************************************************/
2556 2563
2557void 2564void
2558ev_feed_signal (int signum) EV_THROW 2565ev_feed_signal (int signum) EV_NOEXCEPT
2559{ 2566{
2560#if EV_MULTIPLICITY 2567#if EV_MULTIPLICITY
2561 EV_P; 2568 EV_P;
2562 ECB_MEMORY_FENCE_ACQUIRE; 2569 ECB_MEMORY_FENCE_ACQUIRE;
2563 EV_A = signals [signum - 1].loop; 2570 EV_A = signals [signum - 1].loop;
2580 ev_feed_signal (signum); 2587 ev_feed_signal (signum);
2581} 2588}
2582 2589
2583noinline 2590noinline
2584void 2591void
2585ev_feed_signal_event (EV_P_ int signum) EV_THROW 2592ev_feed_signal_event (EV_P_ int signum) EV_NOEXCEPT
2586{ 2593{
2587 WL w; 2594 WL w;
2588 2595
2589 if (expect_false (signum <= 0 || signum >= EV_NSIG)) 2596 if (expect_false (signum <= 0 || signum >= EV_NSIG))
2590 return; 2597 return;
2707#if EV_USE_SELECT 2714#if EV_USE_SELECT
2708# include "ev_select.c" 2715# include "ev_select.c"
2709#endif 2716#endif
2710 2717
2711ecb_cold int 2718ecb_cold int
2712ev_version_major (void) EV_THROW 2719ev_version_major (void) EV_NOEXCEPT
2713{ 2720{
2714 return EV_VERSION_MAJOR; 2721 return EV_VERSION_MAJOR;
2715} 2722}
2716 2723
2717ecb_cold int 2724ecb_cold int
2718ev_version_minor (void) EV_THROW 2725ev_version_minor (void) EV_NOEXCEPT
2719{ 2726{
2720 return EV_VERSION_MINOR; 2727 return EV_VERSION_MINOR;
2721} 2728}
2722 2729
2723/* return true if we are running with elevated privileges and should ignore env variables */ 2730/* return true if we are running with elevated privileges and should ignore env variables */
2732#endif 2739#endif
2733} 2740}
2734 2741
2735ecb_cold 2742ecb_cold
2736unsigned int 2743unsigned int
2737ev_supported_backends (void) EV_THROW 2744ev_supported_backends (void) EV_NOEXCEPT
2738{ 2745{
2739 unsigned int flags = 0; 2746 unsigned int flags = 0;
2740 2747
2741 if (EV_USE_PORT ) flags |= EVBACKEND_PORT; 2748 if (EV_USE_PORT ) flags |= EVBACKEND_PORT;
2742 if (EV_USE_KQUEUE) flags |= EVBACKEND_KQUEUE; 2749 if (EV_USE_KQUEUE) flags |= EVBACKEND_KQUEUE;
2747 return flags; 2754 return flags;
2748} 2755}
2749 2756
2750ecb_cold 2757ecb_cold
2751unsigned int 2758unsigned int
2752ev_recommended_backends (void) EV_THROW 2759ev_recommended_backends (void) EV_NOEXCEPT
2753{ 2760{
2754 unsigned int flags = ev_supported_backends (); 2761 unsigned int flags = ev_supported_backends ();
2755 2762
2756#ifndef __NetBSD__ 2763#ifndef __NetBSD__
2757 /* kqueue is borked on everything but netbsd apparently */ 2764 /* kqueue is borked on everything but netbsd apparently */
2770 return flags; 2777 return flags;
2771} 2778}
2772 2779
2773ecb_cold 2780ecb_cold
2774unsigned int 2781unsigned int
2775ev_embeddable_backends (void) EV_THROW 2782ev_embeddable_backends (void) EV_NOEXCEPT
2776{ 2783{
2777 int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT; 2784 int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT;
2778 2785
2779 /* epoll embeddability broken on all linux versions up to at least 2.6.23 */ 2786 /* epoll embeddability broken on all linux versions up to at least 2.6.23 */
2780 if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */ 2787 if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */
2782 2789
2783 return flags; 2790 return flags;
2784} 2791}
2785 2792
2786unsigned int 2793unsigned int
2787ev_backend (EV_P) EV_THROW 2794ev_backend (EV_P) EV_NOEXCEPT
2788{ 2795{
2789 return backend; 2796 return backend;
2790} 2797}
2791 2798
2792#if EV_FEATURE_API 2799#if EV_FEATURE_API
2793unsigned int 2800unsigned int
2794ev_iteration (EV_P) EV_THROW 2801ev_iteration (EV_P) EV_NOEXCEPT
2795{ 2802{
2796 return loop_count; 2803 return loop_count;
2797} 2804}
2798 2805
2799unsigned int 2806unsigned int
2800ev_depth (EV_P) EV_THROW 2807ev_depth (EV_P) EV_NOEXCEPT
2801{ 2808{
2802 return loop_depth; 2809 return loop_depth;
2803} 2810}
2804 2811
2805void 2812void
2806ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_THROW 2813ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_NOEXCEPT
2807{ 2814{
2808 io_blocktime = interval; 2815 io_blocktime = interval;
2809} 2816}
2810 2817
2811void 2818void
2812ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW 2819ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_NOEXCEPT
2813{ 2820{
2814 timeout_blocktime = interval; 2821 timeout_blocktime = interval;
2815} 2822}
2816 2823
2817void 2824void
2818ev_set_userdata (EV_P_ void *data) EV_THROW 2825ev_set_userdata (EV_P_ void *data) EV_NOEXCEPT
2819{ 2826{
2820 userdata = data; 2827 userdata = data;
2821} 2828}
2822 2829
2823void * 2830void *
2824ev_userdata (EV_P) EV_THROW 2831ev_userdata (EV_P) EV_NOEXCEPT
2825{ 2832{
2826 return userdata; 2833 return userdata;
2827} 2834}
2828 2835
2829void 2836void
2830ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW 2837ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_NOEXCEPT
2831{ 2838{
2832 invoke_cb = invoke_pending_cb; 2839 invoke_cb = invoke_pending_cb;
2833} 2840}
2834 2841
2835void 2842void
2836ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW 2843ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_NOEXCEPT, void (*acquire)(EV_P) EV_NOEXCEPT) EV_NOEXCEPT
2837{ 2844{
2838 release_cb = release; 2845 release_cb = release;
2839 acquire_cb = acquire; 2846 acquire_cb = acquire;
2840} 2847}
2841#endif 2848#endif
2842 2849
2843/* initialise a loop structure, must be zero-initialised */ 2850/* initialise a loop structure, must be zero-initialised */
2844noinline ecb_cold 2851noinline ecb_cold
2845static void 2852static void
2846loop_init (EV_P_ unsigned int flags) EV_THROW 2853loop_init (EV_P_ unsigned int flags) EV_NOEXCEPT
2847{ 2854{
2848 if (!backend) 2855 if (!backend)
2849 { 2856 {
2850 origflags = flags; 2857 origflags = flags;
2851 2858
3092 3099
3093#if EV_MULTIPLICITY 3100#if EV_MULTIPLICITY
3094 3101
3095ecb_cold 3102ecb_cold
3096struct ev_loop * 3103struct ev_loop *
3097ev_loop_new (unsigned int flags) EV_THROW 3104ev_loop_new (unsigned int flags) EV_NOEXCEPT
3098{ 3105{
3099 EV_P = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop)); 3106 EV_P = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop));
3100 3107
3101 memset (EV_A, 0, sizeof (struct ev_loop)); 3108 memset (EV_A, 0, sizeof (struct ev_loop));
3102 loop_init (EV_A_ flags); 3109 loop_init (EV_A_ flags);
3149} 3156}
3150#endif 3157#endif
3151 3158
3152#if EV_FEATURE_API 3159#if EV_FEATURE_API
3153void ecb_cold 3160void ecb_cold
3154ev_verify (EV_P) EV_THROW 3161ev_verify (EV_P) EV_NOEXCEPT
3155{ 3162{
3156#if EV_VERIFY 3163#if EV_VERIFY
3157 int i; 3164 int i;
3158 WL w, w2; 3165 WL w, w2;
3159 3166
3240ecb_cold 3247ecb_cold
3241struct ev_loop * 3248struct ev_loop *
3242#else 3249#else
3243int 3250int
3244#endif 3251#endif
3245ev_default_loop (unsigned int flags) EV_THROW 3252ev_default_loop (unsigned int flags) EV_NOEXCEPT
3246{ 3253{
3247 if (!ev_default_loop_ptr) 3254 if (!ev_default_loop_ptr)
3248 { 3255 {
3249#if EV_MULTIPLICITY 3256#if EV_MULTIPLICITY
3250 EV_P = ev_default_loop_ptr = &default_loop_struct; 3257 EV_P = ev_default_loop_ptr = &default_loop_struct;
3269 3276
3270 return ev_default_loop_ptr; 3277 return ev_default_loop_ptr;
3271} 3278}
3272 3279
3273void 3280void
3274ev_loop_fork (EV_P) EV_THROW 3281ev_loop_fork (EV_P) EV_NOEXCEPT
3275{ 3282{
3276 postfork = 1; 3283 postfork = 1;
3277} 3284}
3278 3285
3279/*****************************************************************************/ 3286/*****************************************************************************/
3283{ 3290{
3284 EV_CB_INVOKE ((W)w, revents); 3291 EV_CB_INVOKE ((W)w, revents);
3285} 3292}
3286 3293
3287unsigned int 3294unsigned int
3288ev_pending_count (EV_P) EV_THROW 3295ev_pending_count (EV_P) EV_NOEXCEPT
3289{ 3296{
3290 int pri; 3297 int pri;
3291 unsigned int count = 0; 3298 unsigned int count = 0;
3292 3299
3293 for (pri = NUMPRI; pri--; ) 3300 for (pri = NUMPRI; pri--; )
3300void 3307void
3301ev_invoke_pending (EV_P) 3308ev_invoke_pending (EV_P)
3302{ 3309{
3303 pendingpri = NUMPRI; 3310 pendingpri = NUMPRI;
3304 3311
3305 while (pendingpri) /* pendingpri possibly gets modified in the inner loop */ 3312 do
3306 { 3313 {
3307 --pendingpri; 3314 --pendingpri;
3308 3315
3316 /* pendingpri possibly gets modified in the inner loop */
3309 while (pendingcnt [pendingpri]) 3317 while (pendingcnt [pendingpri])
3310 { 3318 {
3311 ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri]; 3319 ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri];
3312 3320
3313 p->w->pending = 0; 3321 p->w->pending = 0;
3314 EV_CB_INVOKE (p->w, p->events); 3322 EV_CB_INVOKE (p->w, p->events);
3315 EV_FREQUENT_CHECK; 3323 EV_FREQUENT_CHECK;
3316 } 3324 }
3317 } 3325 }
3326 while (pendingpri);
3318} 3327}
3319 3328
3320#if EV_IDLE_ENABLE 3329#if EV_IDLE_ENABLE
3321/* make idle watchers pending. this handles the "call-idle */ 3330/* make idle watchers pending. this handles the "call-idle */
3322/* only when higher priorities are idle" logic */ 3331/* only when higher priorities are idle" logic */
3731 3740
3732 return activecnt; 3741 return activecnt;
3733} 3742}
3734 3743
3735void 3744void
3736ev_break (EV_P_ int how) EV_THROW 3745ev_break (EV_P_ int how) EV_NOEXCEPT
3737{ 3746{
3738 loop_done = how; 3747 loop_done = how;
3739} 3748}
3740 3749
3741void 3750void
3742ev_ref (EV_P) EV_THROW 3751ev_ref (EV_P) EV_NOEXCEPT
3743{ 3752{
3744 ++activecnt; 3753 ++activecnt;
3745} 3754}
3746 3755
3747void 3756void
3748ev_unref (EV_P) EV_THROW 3757ev_unref (EV_P) EV_NOEXCEPT
3749{ 3758{
3750 --activecnt; 3759 --activecnt;
3751} 3760}
3752 3761
3753void 3762void
3754ev_now_update (EV_P) EV_THROW 3763ev_now_update (EV_P) EV_NOEXCEPT
3755{ 3764{
3756 time_update (EV_A_ 1e100); 3765 time_update (EV_A_ 1e100);
3757} 3766}
3758 3767
3759void 3768void
3760ev_suspend (EV_P) EV_THROW 3769ev_suspend (EV_P) EV_NOEXCEPT
3761{ 3770{
3762 ev_now_update (EV_A); 3771 ev_now_update (EV_A);
3763} 3772}
3764 3773
3765void 3774void
3766ev_resume (EV_P) EV_THROW 3775ev_resume (EV_P) EV_NOEXCEPT
3767{ 3776{
3768 ev_tstamp mn_prev = mn_now; 3777 ev_tstamp mn_prev = mn_now;
3769 3778
3770 ev_now_update (EV_A); 3779 ev_now_update (EV_A);
3771 timers_reschedule (EV_A_ mn_now - mn_prev); 3780 timers_reschedule (EV_A_ mn_now - mn_prev);
3810 w->pending = 0; 3819 w->pending = 0;
3811 } 3820 }
3812} 3821}
3813 3822
3814int 3823int
3815ev_clear_pending (EV_P_ void *w) EV_THROW 3824ev_clear_pending (EV_P_ void *w) EV_NOEXCEPT
3816{ 3825{
3817 W w_ = (W)w; 3826 W w_ = (W)w;
3818 int pending = w_->pending; 3827 int pending = w_->pending;
3819 3828
3820 if (expect_true (pending)) 3829 if (expect_true (pending))
3854 3863
3855/*****************************************************************************/ 3864/*****************************************************************************/
3856 3865
3857noinline 3866noinline
3858void 3867void
3859ev_io_start (EV_P_ ev_io *w) EV_THROW 3868ev_io_start (EV_P_ ev_io *w) EV_NOEXCEPT
3860{ 3869{
3861 int fd = w->fd; 3870 int fd = w->fd;
3862 3871
3863 if (expect_false (ev_is_active (w))) 3872 if (expect_false (ev_is_active (w)))
3864 return; 3873 return;
3881 EV_FREQUENT_CHECK; 3890 EV_FREQUENT_CHECK;
3882} 3891}
3883 3892
3884noinline 3893noinline
3885void 3894void
3886ev_io_stop (EV_P_ ev_io *w) EV_THROW 3895ev_io_stop (EV_P_ ev_io *w) EV_NOEXCEPT
3887{ 3896{
3888 clear_pending (EV_A_ (W)w); 3897 clear_pending (EV_A_ (W)w);
3889 if (expect_false (!ev_is_active (w))) 3898 if (expect_false (!ev_is_active (w)))
3890 return; 3899 return;
3891 3900
3901 EV_FREQUENT_CHECK; 3910 EV_FREQUENT_CHECK;
3902} 3911}
3903 3912
3904noinline 3913noinline
3905void 3914void
3906ev_timer_start (EV_P_ ev_timer *w) EV_THROW 3915ev_timer_start (EV_P_ ev_timer *w) EV_NOEXCEPT
3907{ 3916{
3908 if (expect_false (ev_is_active (w))) 3917 if (expect_false (ev_is_active (w)))
3909 return; 3918 return;
3910 3919
3911 ev_at (w) += mn_now; 3920 ev_at (w) += mn_now;
3926 /*assert (("libev: internal timer heap corruption", timers [ev_active (w)] == (WT)w));*/ 3935 /*assert (("libev: internal timer heap corruption", timers [ev_active (w)] == (WT)w));*/
3927} 3936}
3928 3937
3929noinline 3938noinline
3930void 3939void
3931ev_timer_stop (EV_P_ ev_timer *w) EV_THROW 3940ev_timer_stop (EV_P_ ev_timer *w) EV_NOEXCEPT
3932{ 3941{
3933 clear_pending (EV_A_ (W)w); 3942 clear_pending (EV_A_ (W)w);
3934 if (expect_false (!ev_is_active (w))) 3943 if (expect_false (!ev_is_active (w)))
3935 return; 3944 return;
3936 3945
3957 EV_FREQUENT_CHECK; 3966 EV_FREQUENT_CHECK;
3958} 3967}
3959 3968
3960noinline 3969noinline
3961void 3970void
3962ev_timer_again (EV_P_ ev_timer *w) EV_THROW 3971ev_timer_again (EV_P_ ev_timer *w) EV_NOEXCEPT
3963{ 3972{
3964 EV_FREQUENT_CHECK; 3973 EV_FREQUENT_CHECK;
3965 3974
3966 clear_pending (EV_A_ (W)w); 3975 clear_pending (EV_A_ (W)w);
3967 3976
3984 3993
3985 EV_FREQUENT_CHECK; 3994 EV_FREQUENT_CHECK;
3986} 3995}
3987 3996
3988ev_tstamp 3997ev_tstamp
3989ev_timer_remaining (EV_P_ ev_timer *w) EV_THROW 3998ev_timer_remaining (EV_P_ ev_timer *w) EV_NOEXCEPT
3990{ 3999{
3991 return ev_at (w) - (ev_is_active (w) ? mn_now : 0.); 4000 return ev_at (w) - (ev_is_active (w) ? mn_now : 0.);
3992} 4001}
3993 4002
3994#if EV_PERIODIC_ENABLE 4003#if EV_PERIODIC_ENABLE
3995noinline 4004noinline
3996void 4005void
3997ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW 4006ev_periodic_start (EV_P_ ev_periodic *w) EV_NOEXCEPT
3998{ 4007{
3999 if (expect_false (ev_is_active (w))) 4008 if (expect_false (ev_is_active (w)))
4000 return; 4009 return;
4001 4010
4002 if (w->reschedule_cb) 4011 if (w->reschedule_cb)
4023 /*assert (("libev: internal periodic heap corruption", ANHE_w (periodics [ev_active (w)]) == (WT)w));*/ 4032 /*assert (("libev: internal periodic heap corruption", ANHE_w (periodics [ev_active (w)]) == (WT)w));*/
4024} 4033}
4025 4034
4026noinline 4035noinline
4027void 4036void
4028ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW 4037ev_periodic_stop (EV_P_ ev_periodic *w) EV_NOEXCEPT
4029{ 4038{
4030 clear_pending (EV_A_ (W)w); 4039 clear_pending (EV_A_ (W)w);
4031 if (expect_false (!ev_is_active (w))) 4040 if (expect_false (!ev_is_active (w)))
4032 return; 4041 return;
4033 4042
4052 EV_FREQUENT_CHECK; 4061 EV_FREQUENT_CHECK;
4053} 4062}
4054 4063
4055noinline 4064noinline
4056void 4065void
4057ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW 4066ev_periodic_again (EV_P_ ev_periodic *w) EV_NOEXCEPT
4058{ 4067{
4059 /* TODO: use adjustheap and recalculation */ 4068 /* TODO: use adjustheap and recalculation */
4060 ev_periodic_stop (EV_A_ w); 4069 ev_periodic_stop (EV_A_ w);
4061 ev_periodic_start (EV_A_ w); 4070 ev_periodic_start (EV_A_ w);
4062} 4071}
4068 4077
4069#if EV_SIGNAL_ENABLE 4078#if EV_SIGNAL_ENABLE
4070 4079
4071noinline 4080noinline
4072void 4081void
4073ev_signal_start (EV_P_ ev_signal *w) EV_THROW 4082ev_signal_start (EV_P_ ev_signal *w) EV_NOEXCEPT
4074{ 4083{
4075 if (expect_false (ev_is_active (w))) 4084 if (expect_false (ev_is_active (w)))
4076 return; 4085 return;
4077 4086
4078 assert (("libev: ev_signal_start called with illegal signal number", w->signum > 0 && w->signum < EV_NSIG)); 4087 assert (("libev: ev_signal_start called with illegal signal number", w->signum > 0 && w->signum < EV_NSIG));
4151 EV_FREQUENT_CHECK; 4160 EV_FREQUENT_CHECK;
4152} 4161}
4153 4162
4154noinline 4163noinline
4155void 4164void
4156ev_signal_stop (EV_P_ ev_signal *w) EV_THROW 4165ev_signal_stop (EV_P_ ev_signal *w) EV_NOEXCEPT
4157{ 4166{
4158 clear_pending (EV_A_ (W)w); 4167 clear_pending (EV_A_ (W)w);
4159 if (expect_false (!ev_is_active (w))) 4168 if (expect_false (!ev_is_active (w)))
4160 return; 4169 return;
4161 4170
4192#endif 4201#endif
4193 4202
4194#if EV_CHILD_ENABLE 4203#if EV_CHILD_ENABLE
4195 4204
4196void 4205void
4197ev_child_start (EV_P_ ev_child *w) EV_THROW 4206ev_child_start (EV_P_ ev_child *w) EV_NOEXCEPT
4198{ 4207{
4199#if EV_MULTIPLICITY 4208#if EV_MULTIPLICITY
4200 assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr)); 4209 assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr));
4201#endif 4210#endif
4202 if (expect_false (ev_is_active (w))) 4211 if (expect_false (ev_is_active (w)))
4209 4218
4210 EV_FREQUENT_CHECK; 4219 EV_FREQUENT_CHECK;
4211} 4220}
4212 4221
4213void 4222void
4214ev_child_stop (EV_P_ ev_child *w) EV_THROW 4223ev_child_stop (EV_P_ ev_child *w) EV_NOEXCEPT
4215{ 4224{
4216 clear_pending (EV_A_ (W)w); 4225 clear_pending (EV_A_ (W)w);
4217 if (expect_false (!ev_is_active (w))) 4226 if (expect_false (!ev_is_active (w)))
4218 return; 4227 return;
4219 4228
4484#else 4493#else
4485# define EV_LSTAT(p,b) lstat (p, b) 4494# define EV_LSTAT(p,b) lstat (p, b)
4486#endif 4495#endif
4487 4496
4488void 4497void
4489ev_stat_stat (EV_P_ ev_stat *w) EV_THROW 4498ev_stat_stat (EV_P_ ev_stat *w) EV_NOEXCEPT
4490{ 4499{
4491 if (lstat (w->path, &w->attr) < 0) 4500 if (lstat (w->path, &w->attr) < 0)
4492 w->attr.st_nlink = 0; 4501 w->attr.st_nlink = 0;
4493 else if (!w->attr.st_nlink) 4502 else if (!w->attr.st_nlink)
4494 w->attr.st_nlink = 1; 4503 w->attr.st_nlink = 1;
4534 ev_feed_event (EV_A_ w, EV_STAT); 4543 ev_feed_event (EV_A_ w, EV_STAT);
4535 } 4544 }
4536} 4545}
4537 4546
4538void 4547void
4539ev_stat_start (EV_P_ ev_stat *w) EV_THROW 4548ev_stat_start (EV_P_ ev_stat *w) EV_NOEXCEPT
4540{ 4549{
4541 if (expect_false (ev_is_active (w))) 4550 if (expect_false (ev_is_active (w)))
4542 return; 4551 return;
4543 4552
4544 ev_stat_stat (EV_A_ w); 4553 ev_stat_stat (EV_A_ w);
4565 4574
4566 EV_FREQUENT_CHECK; 4575 EV_FREQUENT_CHECK;
4567} 4576}
4568 4577
4569void 4578void
4570ev_stat_stop (EV_P_ ev_stat *w) EV_THROW 4579ev_stat_stop (EV_P_ ev_stat *w) EV_NOEXCEPT
4571{ 4580{
4572 clear_pending (EV_A_ (W)w); 4581 clear_pending (EV_A_ (W)w);
4573 if (expect_false (!ev_is_active (w))) 4582 if (expect_false (!ev_is_active (w)))
4574 return; 4583 return;
4575 4584
4591} 4600}
4592#endif 4601#endif
4593 4602
4594#if EV_IDLE_ENABLE 4603#if EV_IDLE_ENABLE
4595void 4604void
4596ev_idle_start (EV_P_ ev_idle *w) EV_THROW 4605ev_idle_start (EV_P_ ev_idle *w) EV_NOEXCEPT
4597{ 4606{
4598 if (expect_false (ev_is_active (w))) 4607 if (expect_false (ev_is_active (w)))
4599 return; 4608 return;
4600 4609
4601 pri_adjust (EV_A_ (W)w); 4610 pri_adjust (EV_A_ (W)w);
4614 4623
4615 EV_FREQUENT_CHECK; 4624 EV_FREQUENT_CHECK;
4616} 4625}
4617 4626
4618void 4627void
4619ev_idle_stop (EV_P_ ev_idle *w) EV_THROW 4628ev_idle_stop (EV_P_ ev_idle *w) EV_NOEXCEPT
4620{ 4629{
4621 clear_pending (EV_A_ (W)w); 4630 clear_pending (EV_A_ (W)w);
4622 if (expect_false (!ev_is_active (w))) 4631 if (expect_false (!ev_is_active (w)))
4623 return; 4632 return;
4624 4633
4638} 4647}
4639#endif 4648#endif
4640 4649
4641#if EV_PREPARE_ENABLE 4650#if EV_PREPARE_ENABLE
4642void 4651void
4643ev_prepare_start (EV_P_ ev_prepare *w) EV_THROW 4652ev_prepare_start (EV_P_ ev_prepare *w) EV_NOEXCEPT
4644{ 4653{
4645 if (expect_false (ev_is_active (w))) 4654 if (expect_false (ev_is_active (w)))
4646 return; 4655 return;
4647 4656
4648 EV_FREQUENT_CHECK; 4657 EV_FREQUENT_CHECK;
4653 4662
4654 EV_FREQUENT_CHECK; 4663 EV_FREQUENT_CHECK;
4655} 4664}
4656 4665
4657void 4666void
4658ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW 4667ev_prepare_stop (EV_P_ ev_prepare *w) EV_NOEXCEPT
4659{ 4668{
4660 clear_pending (EV_A_ (W)w); 4669 clear_pending (EV_A_ (W)w);
4661 if (expect_false (!ev_is_active (w))) 4670 if (expect_false (!ev_is_active (w)))
4662 return; 4671 return;
4663 4672
4676} 4685}
4677#endif 4686#endif
4678 4687
4679#if EV_CHECK_ENABLE 4688#if EV_CHECK_ENABLE
4680void 4689void
4681ev_check_start (EV_P_ ev_check *w) EV_THROW 4690ev_check_start (EV_P_ ev_check *w) EV_NOEXCEPT
4682{ 4691{
4683 if (expect_false (ev_is_active (w))) 4692 if (expect_false (ev_is_active (w)))
4684 return; 4693 return;
4685 4694
4686 EV_FREQUENT_CHECK; 4695 EV_FREQUENT_CHECK;
4691 4700
4692 EV_FREQUENT_CHECK; 4701 EV_FREQUENT_CHECK;
4693} 4702}
4694 4703
4695void 4704void
4696ev_check_stop (EV_P_ ev_check *w) EV_THROW 4705ev_check_stop (EV_P_ ev_check *w) EV_NOEXCEPT
4697{ 4706{
4698 clear_pending (EV_A_ (W)w); 4707 clear_pending (EV_A_ (W)w);
4699 if (expect_false (!ev_is_active (w))) 4708 if (expect_false (!ev_is_active (w)))
4700 return; 4709 return;
4701 4710
4715#endif 4724#endif
4716 4725
4717#if EV_EMBED_ENABLE 4726#if EV_EMBED_ENABLE
4718noinline 4727noinline
4719void 4728void
4720ev_embed_sweep (EV_P_ ev_embed *w) EV_THROW 4729ev_embed_sweep (EV_P_ ev_embed *w) EV_NOEXCEPT
4721{ 4730{
4722 ev_run (w->other, EVRUN_NOWAIT); 4731 ev_run (w->other, EVRUN_NOWAIT);
4723} 4732}
4724 4733
4725static void 4734static void
4773 ev_idle_stop (EV_A_ idle); 4782 ev_idle_stop (EV_A_ idle);
4774} 4783}
4775#endif 4784#endif
4776 4785
4777void 4786void
4778ev_embed_start (EV_P_ ev_embed *w) EV_THROW 4787ev_embed_start (EV_P_ ev_embed *w) EV_NOEXCEPT
4779{ 4788{
4780 if (expect_false (ev_is_active (w))) 4789 if (expect_false (ev_is_active (w)))
4781 return; 4790 return;
4782 4791
4783 { 4792 {
4804 4813
4805 EV_FREQUENT_CHECK; 4814 EV_FREQUENT_CHECK;
4806} 4815}
4807 4816
4808void 4817void
4809ev_embed_stop (EV_P_ ev_embed *w) EV_THROW 4818ev_embed_stop (EV_P_ ev_embed *w) EV_NOEXCEPT
4810{ 4819{
4811 clear_pending (EV_A_ (W)w); 4820 clear_pending (EV_A_ (W)w);
4812 if (expect_false (!ev_is_active (w))) 4821 if (expect_false (!ev_is_active (w)))
4813 return; 4822 return;
4814 4823
4824} 4833}
4825#endif 4834#endif
4826 4835
4827#if EV_FORK_ENABLE 4836#if EV_FORK_ENABLE
4828void 4837void
4829ev_fork_start (EV_P_ ev_fork *w) EV_THROW 4838ev_fork_start (EV_P_ ev_fork *w) EV_NOEXCEPT
4830{ 4839{
4831 if (expect_false (ev_is_active (w))) 4840 if (expect_false (ev_is_active (w)))
4832 return; 4841 return;
4833 4842
4834 EV_FREQUENT_CHECK; 4843 EV_FREQUENT_CHECK;
4839 4848
4840 EV_FREQUENT_CHECK; 4849 EV_FREQUENT_CHECK;
4841} 4850}
4842 4851
4843void 4852void
4844ev_fork_stop (EV_P_ ev_fork *w) EV_THROW 4853ev_fork_stop (EV_P_ ev_fork *w) EV_NOEXCEPT
4845{ 4854{
4846 clear_pending (EV_A_ (W)w); 4855 clear_pending (EV_A_ (W)w);
4847 if (expect_false (!ev_is_active (w))) 4856 if (expect_false (!ev_is_active (w)))
4848 return; 4857 return;
4849 4858
4862} 4871}
4863#endif 4872#endif
4864 4873
4865#if EV_CLEANUP_ENABLE 4874#if EV_CLEANUP_ENABLE
4866void 4875void
4867ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW 4876ev_cleanup_start (EV_P_ ev_cleanup *w) EV_NOEXCEPT
4868{ 4877{
4869 if (expect_false (ev_is_active (w))) 4878 if (expect_false (ev_is_active (w)))
4870 return; 4879 return;
4871 4880
4872 EV_FREQUENT_CHECK; 4881 EV_FREQUENT_CHECK;
4879 ev_unref (EV_A); 4888 ev_unref (EV_A);
4880 EV_FREQUENT_CHECK; 4889 EV_FREQUENT_CHECK;
4881} 4890}
4882 4891
4883void 4892void
4884ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW 4893ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_NOEXCEPT
4885{ 4894{
4886 clear_pending (EV_A_ (W)w); 4895 clear_pending (EV_A_ (W)w);
4887 if (expect_false (!ev_is_active (w))) 4896 if (expect_false (!ev_is_active (w)))
4888 return; 4897 return;
4889 4898
4903} 4912}
4904#endif 4913#endif
4905 4914
4906#if EV_ASYNC_ENABLE 4915#if EV_ASYNC_ENABLE
4907void 4916void
4908ev_async_start (EV_P_ ev_async *w) EV_THROW 4917ev_async_start (EV_P_ ev_async *w) EV_NOEXCEPT
4909{ 4918{
4910 if (expect_false (ev_is_active (w))) 4919 if (expect_false (ev_is_active (w)))
4911 return; 4920 return;
4912 4921
4913 w->sent = 0; 4922 w->sent = 0;
4922 4931
4923 EV_FREQUENT_CHECK; 4932 EV_FREQUENT_CHECK;
4924} 4933}
4925 4934
4926void 4935void
4927ev_async_stop (EV_P_ ev_async *w) EV_THROW 4936ev_async_stop (EV_P_ ev_async *w) EV_NOEXCEPT
4928{ 4937{
4929 clear_pending (EV_A_ (W)w); 4938 clear_pending (EV_A_ (W)w);
4930 if (expect_false (!ev_is_active (w))) 4939 if (expect_false (!ev_is_active (w)))
4931 return; 4940 return;
4932 4941
4943 4952
4944 EV_FREQUENT_CHECK; 4953 EV_FREQUENT_CHECK;
4945} 4954}
4946 4955
4947void 4956void
4948ev_async_send (EV_P_ ev_async *w) EV_THROW 4957ev_async_send (EV_P_ ev_async *w) EV_NOEXCEPT
4949{ 4958{
4950 w->sent = 1; 4959 w->sent = 1;
4951 evpipe_write (EV_A_ &async_pending); 4960 evpipe_write (EV_A_ &async_pending);
4952} 4961}
4953#endif 4962#endif
4990 4999
4991 once_cb (EV_A_ once, revents | ev_clear_pending (EV_A_ &once->io)); 5000 once_cb (EV_A_ once, revents | ev_clear_pending (EV_A_ &once->io));
4992} 5001}
4993 5002
4994void 5003void
4995ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_THROW 5004ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_NOEXCEPT
4996{ 5005{
4997 struct ev_once *once = (struct ev_once *)ev_malloc (sizeof (struct ev_once)); 5006 struct ev_once *once = (struct ev_once *)ev_malloc (sizeof (struct ev_once));
4998 5007
4999 if (expect_false (!once)) 5008 if (expect_false (!once))
5000 { 5009 {
5023/*****************************************************************************/ 5032/*****************************************************************************/
5024 5033
5025#if EV_WALK_ENABLE 5034#if EV_WALK_ENABLE
5026ecb_cold 5035ecb_cold
5027void 5036void
5028ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW 5037ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_NOEXCEPT
5029{ 5038{
5030 int i, j; 5039 int i, j;
5031 ev_watcher_list *wl, *wn; 5040 ev_watcher_list *wl, *wn;
5032 5041
5033 if (types & (EV_IO | EV_EMBED)) 5042 if (types & (EV_IO | EV_EMBED))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines