… | |
… | |
515 | |
515 | |
516 | #ifndef ECB_H |
516 | #ifndef ECB_H |
517 | #define ECB_H |
517 | #define ECB_H |
518 | |
518 | |
519 | /* 16 bits major, 16 bits minor */ |
519 | /* 16 bits major, 16 bits minor */ |
520 | #define ECB_VERSION 0x00010002 |
520 | #define ECB_VERSION 0x00010003 |
521 | |
521 | |
522 | #ifdef _WIN32 |
522 | #ifdef _WIN32 |
523 | typedef signed char int8_t; |
523 | typedef signed char int8_t; |
524 | typedef unsigned char uint8_t; |
524 | typedef unsigned char uint8_t; |
525 | typedef signed short int16_t; |
525 | typedef signed short int16_t; |
… | |
… | |
546 | #include <inttypes.h> |
546 | #include <inttypes.h> |
547 | #if UINTMAX_MAX > 0xffffffffU |
547 | #if UINTMAX_MAX > 0xffffffffU |
548 | #define ECB_PTRSIZE 8 |
548 | #define ECB_PTRSIZE 8 |
549 | #else |
549 | #else |
550 | #define ECB_PTRSIZE 4 |
550 | #define ECB_PTRSIZE 4 |
|
|
551 | #endif |
|
|
552 | #endif |
|
|
553 | |
|
|
554 | /* work around x32 idiocy by defining proper macros */ |
|
|
555 | #if __x86_64 || _M_AMD64 |
|
|
556 | #if __ILP32 |
|
|
557 | #define ECB_AMD64_X32 1 |
|
|
558 | #else |
|
|
559 | #define ECB_AMD64 1 |
551 | #endif |
560 | #endif |
552 | #endif |
561 | #endif |
553 | |
562 | |
554 | /* many compilers define _GNUC_ to some versions but then only implement |
563 | /* many compilers define _GNUC_ to some versions but then only implement |
555 | * what their idiot authors think are the "more important" extensions, |
564 | * what their idiot authors think are the "more important" extensions, |
… | |
… | |
2095 | ev_syserr ("(libev) error creating signal/async pipe"); |
2104 | ev_syserr ("(libev) error creating signal/async pipe"); |
2096 | |
2105 | |
2097 | fd_intern (fds [0]); |
2106 | fd_intern (fds [0]); |
2098 | } |
2107 | } |
2099 | |
2108 | |
2100 | fd_intern (fds [1]); |
|
|
2101 | |
|
|
2102 | evpipe [0] = fds [0]; |
2109 | evpipe [0] = fds [0]; |
2103 | |
2110 | |
2104 | if (evpipe [1] < 0) |
2111 | if (evpipe [1] < 0) |
2105 | evpipe [1] = fds [1]; /* first call, set write fd */ |
2112 | evpipe [1] = fds [1]; /* first call, set write fd */ |
2106 | else |
2113 | else |
… | |
… | |
2111 | /* so must not be executed on windows */ |
2118 | /* so must not be executed on windows */ |
2112 | |
2119 | |
2113 | dup2 (fds [1], evpipe [1]); |
2120 | dup2 (fds [1], evpipe [1]); |
2114 | close (fds [1]); |
2121 | close (fds [1]); |
2115 | } |
2122 | } |
|
|
2123 | |
|
|
2124 | fd_intern (evpipe [1]); |
2116 | |
2125 | |
2117 | ev_io_set (&pipe_w, evpipe [0] < 0 ? evpipe [1] : evpipe [0], EV_READ); |
2126 | ev_io_set (&pipe_w, evpipe [0] < 0 ? evpipe [1] : evpipe [0], EV_READ); |
2118 | ev_io_start (EV_A_ &pipe_w); |
2127 | ev_io_start (EV_A_ &pipe_w); |
2119 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
2128 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
2120 | } |
2129 | } |
… | |
… | |
2239 | |
2248 | |
2240 | void |
2249 | void |
2241 | ev_feed_signal (int signum) EV_THROW |
2250 | ev_feed_signal (int signum) EV_THROW |
2242 | { |
2251 | { |
2243 | #if EV_MULTIPLICITY |
2252 | #if EV_MULTIPLICITY |
|
|
2253 | EV_P; |
2244 | ECB_MEMORY_FENCE_ACQUIRE; |
2254 | ECB_MEMORY_FENCE_ACQUIRE; |
2245 | EV_P = signals [signum - 1].loop; |
2255 | EV_A = signals [signum - 1].loop; |
2246 | |
2256 | |
2247 | if (!EV_A) |
2257 | if (!EV_A) |
2248 | return; |
2258 | return; |
2249 | #endif |
2259 | #endif |
2250 | |
2260 | |