Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <uv.h>
  4.  
  5. uv_loop_t *loop;
  6. uv_timer_t gc_req;
  7. uv_timer_t fake_job_req;
  8.  
  9. void fake_job(uv_timer_t* timer, int status) {
  10.     printf("%ld\n", (long int) time(NULL));
  11.     sleep(2);
  12. }
  13.  
  14. int main() {
  15.     loop = uv_default_loop();
  16.  
  17.     // could actually be a TCP download or something
  18.     uv_timer_init(loop, &fake_job_req);
  19.     uv_timer_start(&fake_job_req, fake_job, 0, 5000);
  20.     return uv_run(loop, UV_RUN_DEFAULT);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement