… | |
… | |
609 | #define ECB_CLANG_EXTENSION(x) 0 |
609 | #define ECB_CLANG_EXTENSION(x) 0 |
610 | #endif |
610 | #endif |
611 | |
611 | |
612 | #define ECB_CPP (__cplusplus+0) |
612 | #define ECB_CPP (__cplusplus+0) |
613 | #define ECB_CPP11 (__cplusplus >= 201103L) |
613 | #define ECB_CPP11 (__cplusplus >= 201103L) |
|
|
614 | #define ECB_CPP14 (__cplusplus >= 201402L) |
|
|
615 | #define ECB_CPP17 (__cplusplus >= 201703L) |
614 | |
616 | |
615 | #if ECB_CPP |
617 | #if ECB_CPP |
616 | #define ECB_C 0 |
618 | #define ECB_C 0 |
617 | #define ECB_STDC_VERSION 0 |
619 | #define ECB_STDC_VERSION 0 |
618 | #else |
620 | #else |
… | |
… | |
620 | #define ECB_STDC_VERSION __STDC_VERSION__ |
622 | #define ECB_STDC_VERSION __STDC_VERSION__ |
621 | #endif |
623 | #endif |
622 | |
624 | |
623 | #define ECB_C99 (ECB_STDC_VERSION >= 199901L) |
625 | #define ECB_C99 (ECB_STDC_VERSION >= 199901L) |
624 | #define ECB_C11 (ECB_STDC_VERSION >= 201112L) |
626 | #define ECB_C11 (ECB_STDC_VERSION >= 201112L) |
|
|
627 | #define ECB_C17 (ECB_STDC_VERSION >= 201710L) |
625 | |
628 | |
626 | #if ECB_CPP |
629 | #if ECB_CPP |
627 | #define ECB_EXTERN_C extern "C" |
630 | #define ECB_EXTERN_C extern "C" |
628 | #define ECB_EXTERN_C_BEG ECB_EXTERN_C { |
631 | #define ECB_EXTERN_C_BEG ECB_EXTERN_C { |
629 | #define ECB_EXTERN_C_END } |
632 | #define ECB_EXTERN_C_END } |
… | |
… | |
658 | #ifndef ECB_MEMORY_FENCE |
661 | #ifndef ECB_MEMORY_FENCE |
659 | #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 |
660 | #if __i386 || __i386__ |
663 | #if __i386 || __i386__ |
661 | #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") |
662 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") |
665 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") |
663 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") |
666 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory") |
664 | #elif ECB_GCC_AMD64 |
667 | #elif ECB_GCC_AMD64 |
665 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") |
668 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") |
666 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") |
669 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") |
667 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") |
670 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory") |
668 | #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ |
671 | #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ |
669 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") |
672 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") |
670 | #elif defined __ARM_ARCH_2__ \ |
673 | #elif defined __ARM_ARCH_2__ \ |
671 | || defined __ARM_ARCH_3__ || defined __ARM_ARCH_3M__ \ |
674 | || defined __ARM_ARCH_3__ || defined __ARM_ARCH_3M__ \ |
672 | || defined __ARM_ARCH_4__ || defined __ARM_ARCH_4T__ \ |
675 | || defined __ARM_ARCH_4__ || defined __ARM_ARCH_4T__ \ |
… | |
… | |
5000 | void |
5003 | void |
5001 | ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_NOEXCEPT |
5004 | ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_NOEXCEPT |
5002 | { |
5005 | { |
5003 | 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)); |
5004 | |
5007 | |
5005 | if (expect_false (!once)) |
|
|
5006 | { |
|
|
5007 | cb (EV_ERROR | EV_READ | EV_WRITE | EV_TIMER, arg); |
|
|
5008 | return; |
|
|
5009 | } |
|
|
5010 | |
|
|
5011 | once->cb = cb; |
5008 | once->cb = cb; |
5012 | once->arg = arg; |
5009 | once->arg = arg; |
5013 | |
5010 | |
5014 | ev_init (&once->io, once_cb_io); |
5011 | ev_init (&once->io, once_cb_io); |
5015 | if (fd >= 0) |
5012 | if (fd >= 0) |