… | |
… | |
497 | #ifndef ECB_MEMORY_FENCE |
497 | #ifndef ECB_MEMORY_FENCE |
498 | #if ECB_GCC_VERSION(2,5) |
498 | #if ECB_GCC_VERSION(2,5) |
499 | #if __x86 |
499 | #if __x86 |
500 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") |
500 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") |
501 | #define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE |
501 | #define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE |
502 | #define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE /* better be safe than sorry */ |
502 | #define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE |
503 | #elif __amd64 |
503 | #elif __amd64 |
504 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") |
504 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") |
505 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("lfence" : : : "memory") |
505 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("lfence" : : : "memory") |
506 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("sfence") |
506 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("sfence") |
507 | #endif |
507 | #endif |
… | |
… | |
1456 | |
1456 | |
1457 | inline_speed void |
1457 | inline_speed void |
1458 | evpipe_write (EV_P_ EV_ATOMIC_T *flag) |
1458 | evpipe_write (EV_P_ EV_ATOMIC_T *flag) |
1459 | { |
1459 | { |
1460 | if (expect_true (*flag)) |
1460 | if (expect_true (*flag)) |
1461 | /*return*//*D*/; |
1461 | return; |
1462 | |
1462 | |
1463 | *flag = 1; |
1463 | *flag = 1; |
1464 | |
1464 | |
1465 | ECB_MEMORY_FENCE_RELEASE; /* make sure flag is visible before the wakeup */ |
1465 | ECB_MEMORY_FENCE_RELEASE; /* make sure flag is visible before the wakeup */ |
1466 | |
1466 | |