-
-
Save Quby/1565434 to your computer and use it in GitHub Desktop.
Revisions
-
Quby created this gist
Jan 5, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #include "./../deps/libuv/include/uv.h" #include <stdio.h> int msg; void mkdir_cb (uv_fs_t* req) { int* msg = req->data; printf("send(%d)\n", *msg); } void main () { uv_loop_t* loop = uv_loop_new(); uv_fs_t req; msg = 432; req.data = &msg; const char* path = "test"; uv_fs_mkdir(loop, &req, path, 0777, mkdir_cb); uv_run(loop); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #include "./../deps/libuv/include/uv.h" #include <stdio.h> //gcc -pthread ../deps/libuv/bin/*.o ex2.c -lrt -ldl -lm -o ex2 uv_loop_t* loop; void timer_cb1 (uv_timer_t* timer, int status) { printf("1\n", status); uv_timer_stop(timer); uv_unref(loop); } void timer_cb2 (uv_timer_t* timer, int status) { printf("2\n", status); uv_timer_stop(timer); uv_unref(loop); } void main () { loop = uv_default_loop(); uv_timer_t timer1; uv_timer_init(loop, &timer1); uv_timer_start(&timer1, (uv_timer_cb) &timer_cb1, 1000, 1000); uv_timer_t timer2; uv_timer_init(loop, &timer2); uv_timer_start(&timer2, (uv_timer_cb) &timer_cb1, 500, 1000); uv_run(loop); }