… | |
… | |
183 | # include EV_H |
183 | # include EV_H |
184 | #else |
184 | #else |
185 | # include "ev.h" |
185 | # include "ev.h" |
186 | #endif |
186 | #endif |
187 | |
187 | |
|
|
188 | #if EV_NO_THREADS |
|
|
189 | # undef EV_NO_SMP |
|
|
190 | # define EV_NO_SMP 1 |
|
|
191 | # undef ECB_NO_THREADS |
|
|
192 | # define ECB_NO_THREADS 1 |
|
|
193 | #endif |
|
|
194 | #if EV_NO_SMP |
|
|
195 | # undef EV_NO_SMP |
|
|
196 | # define ECB_NO_SMP 1 |
|
|
197 | #endif |
|
|
198 | |
188 | #ifndef _WIN32 |
199 | #ifndef _WIN32 |
189 | # include <sys/time.h> |
200 | # include <sys/time.h> |
190 | # include <sys/wait.h> |
201 | # include <sys/wait.h> |
191 | # include <unistd.h> |
202 | # include <unistd.h> |
192 | #else |
203 | #else |
… | |
… | |
534 | /*****************************************************************************/ |
545 | /*****************************************************************************/ |
535 | |
546 | |
536 | /* ECB_NO_THREADS - ecb is not used by multiple threads, ever */ |
547 | /* ECB_NO_THREADS - ecb is not used by multiple threads, ever */ |
537 | /* ECB_NO_SMP - ecb might be used in multiple threads, but only on a single cpu */ |
548 | /* ECB_NO_SMP - ecb might be used in multiple threads, but only on a single cpu */ |
538 | |
549 | |
|
|
550 | #if ECB_NO_THREADS |
|
|
551 | # define ECB_NO_SMP 1 |
|
|
552 | #endif |
|
|
553 | |
539 | #if ECB_NO_THREADS || ECB_NO_SMP |
554 | #if ECB_NO_THREADS || ECB_NO_SMP |
540 | #define ECB_MEMORY_FENCE do { } while (0) |
555 | #define ECB_MEMORY_FENCE do { } while (0) |
541 | #endif |
556 | #endif |
542 | |
557 | |
543 | #ifndef ECB_MEMORY_FENCE |
558 | #ifndef ECB_MEMORY_FENCE |
544 | #if ECB_GCC_VERSION(2,5) || defined(__INTEL_COMPILER) || defined(__clang__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 |
559 | #if ECB_GCC_VERSION(2,5) || defined(__INTEL_COMPILER) || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 |
545 | #if __i386 || __i386__ |
560 | #if __i386 || __i386__ |
546 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") |
561 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") |
547 | #define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE /* non-lock xchg might be enough */ |
562 | #define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE /* non-lock xchg might be enough */ |
548 | #define ECB_MEMORY_FENCE_RELEASE do { } while (0) /* unlikely to change in future cpus */ |
563 | #define ECB_MEMORY_FENCE_RELEASE do { } while (0) /* unlikely to change in future cpus */ |
549 | #elif __amd64 || __amd64__ || __x86_64 || __x86_64__ |
564 | #elif __amd64 || __amd64__ || __x86_64 || __x86_64__ |
… | |
… | |
562 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad | " : : : "memory") |
577 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad | " : : : "memory") |
563 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") |
578 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") |
564 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") |
579 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") |
565 | #elif defined(__s390__) || defined(__s390x__) |
580 | #elif defined(__s390__) || defined(__s390x__) |
566 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory") |
581 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory") |
|
|
582 | #elif defined(__mips__) |
|
|
583 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") |
567 | #endif |
584 | #endif |
568 | #endif |
585 | #endif |
569 | #endif |
586 | #endif |
570 | |
587 | |
571 | #ifndef ECB_MEMORY_FENCE |
588 | #ifndef ECB_MEMORY_FENCE |
… | |
… | |
584 | #elif __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 |
601 | #elif __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 |
585 | #include <mbarrier.h> |
602 | #include <mbarrier.h> |
586 | #define ECB_MEMORY_FENCE __machine_rw_barrier () |
603 | #define ECB_MEMORY_FENCE __machine_rw_barrier () |
587 | #define ECB_MEMORY_FENCE_ACQUIRE __machine_r_barrier () |
604 | #define ECB_MEMORY_FENCE_ACQUIRE __machine_r_barrier () |
588 | #define ECB_MEMORY_FENCE_RELEASE __machine_w_barrier () |
605 | #define ECB_MEMORY_FENCE_RELEASE __machine_w_barrier () |
|
|
606 | #elif __xlC__ |
|
|
607 | #define ECB_MEMORY_FENCE __sync () |
589 | #endif |
608 | #endif |
590 | #endif |
609 | #endif |
591 | |
610 | |
592 | #ifndef ECB_MEMORY_FENCE |
611 | #ifndef ECB_MEMORY_FENCE |
593 | #if !ECB_AVOID_PTHREADS |
612 | #if !ECB_AVOID_PTHREADS |
… | |
… | |
1856 | /* win32 people keep sending patches that change this write() to send() */ |
1875 | /* win32 people keep sending patches that change this write() to send() */ |
1857 | /* and then run away. but send() is wrong, it wants a socket handle on win32 */ |
1876 | /* and then run away. but send() is wrong, it wants a socket handle on win32 */ |
1858 | /* so when you think this write should be a send instead, please find out */ |
1877 | /* so when you think this write should be a send instead, please find out */ |
1859 | /* where your send() is from - it's definitely not the microsoft send, and */ |
1878 | /* where your send() is from - it's definitely not the microsoft send, and */ |
1860 | /* tell me. thank you. */ |
1879 | /* tell me. thank you. */ |
|
|
1880 | /* it might be that your problem is that your environment needs EV_USE_WSASOCKET */ |
|
|
1881 | /* check the ev documentation on how to use this flag */ |
1861 | write (evpipe [1], &(evpipe [1]), 1); |
1882 | write (evpipe [1], &(evpipe [1]), 1); |
1862 | } |
1883 | } |
1863 | |
1884 | |
1864 | errno = old_errno; |
1885 | errno = old_errno; |
1865 | } |
1886 | } |