… | |
… | |
196 | # define EV_SELECT_IS_WINSOCKET 1 |
196 | # define EV_SELECT_IS_WINSOCKET 1 |
197 | # endif |
197 | # endif |
198 | # undef EV_AVOID_STDIO |
198 | # undef EV_AVOID_STDIO |
199 | #endif |
199 | #endif |
200 | |
200 | |
|
|
201 | /* OS X, in its infinite idiocy, actually HARDCODES |
|
|
202 | * a limit of 1024 into their select. Where people have brains, |
|
|
203 | * OS X engineers apparently have a vacuum. Or maybe they were |
|
|
204 | * ordered to have a vacuum, or they do anything for money. |
|
|
205 | * This might help. Or not. |
|
|
206 | */ |
|
|
207 | #define _DARWIN_UNLIMITED_SELECT 1 |
|
|
208 | |
201 | /* this block tries to deduce configuration from header-defined symbols and defaults */ |
209 | /* this block tries to deduce configuration from header-defined symbols and defaults */ |
202 | |
210 | |
203 | /* try to deduce the maximum number of signals on this platform */ |
211 | /* try to deduce the maximum number of signals on this platform */ |
204 | #if defined (EV_NSIG) |
212 | #if defined (EV_NSIG) |
205 | /* use what's provided */ |
213 | /* use what's provided */ |
… | |
… | |
503 | #define ev_active(w) ((W)(w))->active |
511 | #define ev_active(w) ((W)(w))->active |
504 | #define ev_at(w) ((WT)(w))->at |
512 | #define ev_at(w) ((WT)(w))->at |
505 | |
513 | |
506 | #if EV_USE_REALTIME |
514 | #if EV_USE_REALTIME |
507 | /* 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 */ |
508 | /* giving it a reasonably high chance of working on typical architetcures */ |
516 | /* giving it a reasonably high chance of working on typical architectures */ |
509 | 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? */ |
510 | #endif |
518 | #endif |
511 | |
519 | |
512 | #if EV_USE_MONOTONIC |
520 | #if EV_USE_MONOTONIC |
513 | 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? */ |
… | |
… | |
786 | /*****************************************************************************/ |
794 | /*****************************************************************************/ |
787 | |
795 | |
788 | #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 */ |
789 | |
797 | |
790 | /* find a suitable new size for the given array, */ |
798 | /* find a suitable new size for the given array, */ |
791 | /* hopefully by rounding to a ncie-to-malloc size */ |
799 | /* hopefully by rounding to a nice-to-malloc size */ |
792 | inline_size int |
800 | inline_size int |
793 | array_nextsize (int elem, int cur, int cnt) |
801 | array_nextsize (int elem, int cur, int cnt) |
794 | { |
802 | { |
795 | int ncur = cur + 1; |
803 | int ncur = cur + 1; |
796 | |
804 | |
… | |
… | |
1063 | } |
1071 | } |
1064 | |
1072 | |
1065 | /*****************************************************************************/ |
1073 | /*****************************************************************************/ |
1066 | |
1074 | |
1067 | /* |
1075 | /* |
1068 | * 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 |
1069 | * 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 |
1070 | * the branching factor of the d-tree. |
1078 | * the branching factor of the d-tree. |
1071 | */ |
1079 | */ |
1072 | |
1080 | |
1073 | /* |
1081 | /* |
… | |
… | |
1273 | uint64_t counter = 1; |
1281 | uint64_t counter = 1; |
1274 | write (evfd, &counter, sizeof (uint64_t)); |
1282 | write (evfd, &counter, sizeof (uint64_t)); |
1275 | } |
1283 | } |
1276 | else |
1284 | else |
1277 | #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. */ |
1278 | write (evpipe [1], &dummy, 1); |
1291 | write (evpipe [1], &dummy, 1); |
1279 | |
1292 | |
1280 | errno = old_errno; |
1293 | errno = old_errno; |
1281 | } |
1294 | } |
1282 | } |
1295 | } |
… | |
… | |
1296 | } |
1309 | } |
1297 | else |
1310 | else |
1298 | #endif |
1311 | #endif |
1299 | { |
1312 | { |
1300 | char dummy; |
1313 | char dummy; |
|
|
1314 | /* see discussion in evpipe_write when you think this read should be recv in win32 */ |
1301 | read (evpipe [0], &dummy, 1); |
1315 | read (evpipe [0], &dummy, 1); |
1302 | } |
1316 | } |
1303 | |
1317 | |
1304 | if (sig_pending) |
1318 | if (sig_pending) |
1305 | { |
1319 | { |
… | |
… | |
2171 | feed_reverse_done (EV_A_ EV_PERIODIC); |
2185 | feed_reverse_done (EV_A_ EV_PERIODIC); |
2172 | } |
2186 | } |
2173 | } |
2187 | } |
2174 | |
2188 | |
2175 | /* simply recalculate all periodics */ |
2189 | /* simply recalculate all periodics */ |
2176 | /* 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? */ |
2177 | static void noinline |
2191 | static void noinline |
2178 | periodics_reschedule (EV_P) |
2192 | periodics_reschedule (EV_P) |
2179 | { |
2193 | { |
2180 | int i; |
2194 | int i; |
2181 | |
2195 | |