… | |
… | |
511 | #define ev_active(w) ((W)(w))->active |
511 | #define ev_active(w) ((W)(w))->active |
512 | #define ev_at(w) ((WT)(w))->at |
512 | #define ev_at(w) ((WT)(w))->at |
513 | |
513 | |
514 | #if EV_USE_REALTIME |
514 | #if EV_USE_REALTIME |
515 | /* sig_atomic_t is used to avoid per-thread variables or locking but still */ |
515 | /* sig_atomic_t is used to avoid per-thread variables or locking but still */ |
516 | /* giving it a reasonably high chance of working on typical architetcures */ |
516 | /* giving it a reasonably high chance of working on typical architectures */ |
517 | static EV_ATOMIC_T have_realtime; /* did clock_gettime (CLOCK_REALTIME) work? */ |
517 | static EV_ATOMIC_T have_realtime; /* did clock_gettime (CLOCK_REALTIME) work? */ |
518 | #endif |
518 | #endif |
519 | |
519 | |
520 | #if EV_USE_MONOTONIC |
520 | #if EV_USE_MONOTONIC |
521 | static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */ |
521 | static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */ |
… | |
… | |
794 | /*****************************************************************************/ |
794 | /*****************************************************************************/ |
795 | |
795 | |
796 | #define MALLOC_ROUND 4096 /* prefer to allocate in chunks of this size, must be 2**n and >> 4 longs */ |
796 | #define MALLOC_ROUND 4096 /* prefer to allocate in chunks of this size, must be 2**n and >> 4 longs */ |
797 | |
797 | |
798 | /* find a suitable new size for the given array, */ |
798 | /* find a suitable new size for the given array, */ |
799 | /* hopefully by rounding to a ncie-to-malloc size */ |
799 | /* hopefully by rounding to a nice-to-malloc size */ |
800 | inline_size int |
800 | inline_size int |
801 | array_nextsize (int elem, int cur, int cnt) |
801 | array_nextsize (int elem, int cur, int cnt) |
802 | { |
802 | { |
803 | int ncur = cur + 1; |
803 | int ncur = cur + 1; |
804 | |
804 | |
… | |
… | |
1071 | } |
1071 | } |
1072 | |
1072 | |
1073 | /*****************************************************************************/ |
1073 | /*****************************************************************************/ |
1074 | |
1074 | |
1075 | /* |
1075 | /* |
1076 | * the heap functions want a real array index. array index 0 uis guaranteed to not |
1076 | * the heap functions want a real array index. array index 0 is guaranteed to not |
1077 | * be in-use at any time. the first heap entry is at array [HEAP0]. DHEAP gives |
1077 | * be in-use at any time. the first heap entry is at array [HEAP0]. DHEAP gives |
1078 | * the branching factor of the d-tree. |
1078 | * the branching factor of the d-tree. |
1079 | */ |
1079 | */ |
1080 | |
1080 | |
1081 | /* |
1081 | /* |
… | |
… | |
1281 | uint64_t counter = 1; |
1281 | uint64_t counter = 1; |
1282 | write (evfd, &counter, sizeof (uint64_t)); |
1282 | write (evfd, &counter, sizeof (uint64_t)); |
1283 | } |
1283 | } |
1284 | else |
1284 | else |
1285 | #endif |
1285 | #endif |
|
|
1286 | /* win32 people keep sending patches that change this write() to send() */ |
|
|
1287 | /* and then run away. but send() is wrong, it wants a socket handle on win32 */ |
|
|
1288 | /* so when you think this write should be a send instead, please find out */ |
|
|
1289 | /* where your send() is from - it's definitely not the microsoft send, and */ |
|
|
1290 | /* tell me. thank you. */ |
1286 | write (evpipe [1], &dummy, 1); |
1291 | write (evpipe [1], &dummy, 1); |
1287 | |
1292 | |
1288 | errno = old_errno; |
1293 | errno = old_errno; |
1289 | } |
1294 | } |
1290 | } |
1295 | } |
… | |
… | |
1304 | } |
1309 | } |
1305 | else |
1310 | else |
1306 | #endif |
1311 | #endif |
1307 | { |
1312 | { |
1308 | char dummy; |
1313 | char dummy; |
|
|
1314 | /* see discussion in evpipe_write when you think this read should be recv in win32 */ |
1309 | read (evpipe [0], &dummy, 1); |
1315 | read (evpipe [0], &dummy, 1); |
1310 | } |
1316 | } |
1311 | |
1317 | |
1312 | if (sig_pending) |
1318 | if (sig_pending) |
1313 | { |
1319 | { |
… | |
… | |
2179 | feed_reverse_done (EV_A_ EV_PERIODIC); |
2185 | feed_reverse_done (EV_A_ EV_PERIODIC); |
2180 | } |
2186 | } |
2181 | } |
2187 | } |
2182 | |
2188 | |
2183 | /* simply recalculate all periodics */ |
2189 | /* simply recalculate all periodics */ |
2184 | /* TODO: maybe ensure that at leats one event happens when jumping forward? */ |
2190 | /* TODO: maybe ensure that at least one event happens when jumping forward? */ |
2185 | static void noinline |
2191 | static void noinline |
2186 | periodics_reschedule (EV_P) |
2192 | periodics_reschedule (EV_P) |
2187 | { |
2193 | { |
2188 | int i; |
2194 | int i; |
2189 | |
2195 | |