Skip to content

Instantly share code, notes, and snippets.

@sukinull
Created March 3, 2014 15:43
Show Gist options
  • Save sukinull/9327654 to your computer and use it in GitHub Desktop.
Save sukinull/9327654 to your computer and use it in GitHub Desktop.
//
//
// Created by sukinull on 1/8/14.
// Copyright (c) 2014 sukinull. All rights reserved.
//
// READ: http://nikhilm.github.io/uvbook/basics.html
#include <stdio.h>
#include <uv.h>
int64_t counter = 0;
void wait_for_a_while(uv_idle_t* handle, int status) {
counter++;
if (counter >= 10e6)
uv_idle_stop(handle);
}
int main() {
uv_idle_t idler;
uv_idle_init(uv_default_loop(), &idler);
uv_idle_start(&idler, wait_for_a_while);
printf("Idling...\n");
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment