Skip to content

Instantly share code, notes, and snippets.

@chidumennamdi
Created September 11, 2018 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chidumennamdi/f609642d17cb6f938c48e9c7ca91bbcf to your computer and use it in GitHub Desktop.
Save chidumennamdi/f609642d17cb6f938c48e9c7ca91bbcf to your computer and use it in GitHub Desktop.
// timer.c
void uv__run_timers(uv_loop_t* loop) {
struct heap_node* heap_node;
uv_timer_t* handle;
for (;;) {
heap_node = heap_min(timer_heap(loop));
if (heap_node == NULL)
break;
handle = container_of(heap_node, uv_timer_t, heap_node);
if (handle->timeout > loop->time)
break;
uv_timer_stop(handle);
uv_timer_again(handle);
handle->timer_cb(handle);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment