… | |
… | |
2505 | { |
2505 | { |
2506 | waittime = MAX_BLOCKTIME; |
2506 | waittime = MAX_BLOCKTIME; |
2507 | |
2507 | |
2508 | if (timercnt) |
2508 | if (timercnt) |
2509 | { |
2509 | { |
2510 | ev_tstamp to = ANHE_at (timers [HEAP0]) - mn_now + backend_mintime; |
2510 | ev_tstamp to = ANHE_at (timers [HEAP0]) - mn_now; |
2511 | if (waittime > to) waittime = to; |
2511 | if (waittime > to) waittime = to; |
2512 | } |
2512 | } |
2513 | |
2513 | |
2514 | #if EV_PERIODIC_ENABLE |
2514 | #if EV_PERIODIC_ENABLE |
2515 | if (periodiccnt) |
2515 | if (periodiccnt) |
2516 | { |
2516 | { |
2517 | ev_tstamp to = ANHE_at (periodics [HEAP0]) - ev_rt_now + backend_mintime; |
2517 | ev_tstamp to = ANHE_at (periodics [HEAP0]) - ev_rt_now; |
2518 | if (waittime > to) waittime = to; |
2518 | if (waittime > to) waittime = to; |
2519 | } |
2519 | } |
2520 | #endif |
2520 | #endif |
2521 | |
2521 | |
2522 | /* don't let timeouts decrease the waittime below timeout_blocktime */ |
2522 | /* don't let timeouts decrease the waittime below timeout_blocktime */ |
2523 | if (expect_false (waittime < timeout_blocktime)) |
2523 | if (expect_false (waittime < timeout_blocktime)) |
2524 | waittime = timeout_blocktime; |
2524 | waittime = timeout_blocktime; |
|
|
2525 | |
|
|
2526 | /* at this point, we NEED to wait, so we have to ensure */ |
|
|
2527 | /* to pass a minimum nonzero value to the backend */ |
|
|
2528 | if (expect_false (waittime < backend_mintime)) |
|
|
2529 | waittime = backend_mintime; |
2525 | |
2530 | |
2526 | /* extra check because io_blocktime is commonly 0 */ |
2531 | /* extra check because io_blocktime is commonly 0 */ |
2527 | if (expect_false (io_blocktime)) |
2532 | if (expect_false (io_blocktime)) |
2528 | { |
2533 | { |
2529 | sleeptime = io_blocktime - (mn_now - prev_mn_now); |
2534 | sleeptime = io_blocktime - (mn_now - prev_mn_now); |