1 #include <stdio.h> 2 #include <uv.h> 3 4 int64_t counter = 0; 5 wait_for_a_while(uv_idle_t * handle)6void wait_for_a_while(uv_idle_t* handle) { 7 counter++; 8 9 if (counter >= 10e6) 10 uv_idle_stop(handle); 11 } 12 main()13int main() { 14 uv_idle_t idler; 15 16 uv_idle_init(uv_default_loop(), &idler); 17 uv_idle_start(&idler, wait_for_a_while); 18 19 printf("Idling...\n"); 20 uv_run(uv_default_loop(), UV_RUN_DEFAULT); 21 22 uv_loop_close(uv_default_loop()); 23 return 0; 24 } 25