| 140 | |
| 141 | |
| 142 | int uv__next_timeout(const uv_loop_t* loop) { |
| 143 | const struct heap_node* heap_node; |
| 144 | const uv_timer_t* handle; |
| 145 | uint64_t diff; |
| 146 | |
| 147 | heap_node = heap_min(timer_heap(loop)); |
| 148 | if (heap_node == NULL) |
| 149 | return -1; /* block indefinitely */ |
| 150 | |
| 151 | handle = container_of(heap_node, uv_timer_t, heap_node); |
| 152 | if (handle->timeout <= loop->time) |
| 153 | return 0; |
| 154 | |
| 155 | diff = handle->timeout - loop->time; |
| 156 | if (diff > INT_MAX) |
| 157 | diff = INT_MAX; |
| 158 | |
| 159 | return (int) diff; |
| 160 | } |
| 161 | |
| 162 | |
| 163 | void uv__run_timers(uv_loop_t* loop) { |
no test coverage detected
searching dependent graphs…