Created
March 3, 2014 15:43
-
-
Save sukinull/9327654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
// 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