uv_stop的例子。

master
zcy 2023-05-25 00:10:35 +08:00
parent 4799898fe8
commit e7a1982170
1 changed files with 2 additions and 3 deletions

View File

@ -42,7 +42,7 @@ void async_cb2(uv_async_t* handle)
void idle_cb(uv_async_t *handle) { void idle_cb(uv_async_t *handle) {
printf("Idle callback\n"); printf("Idle callback\n");
uv_stop(uv_default_loop()); uv_stop(uv_default_loop()); // 一定要在回调函数内去调用,主函数内调用不生效。
} }
@ -74,7 +74,6 @@ int main()
}); });
t1.detach(); t1.detach();
uv_run(loop, UV_RUN_DEFAULT); uv_run(loop, UV_RUN_DEFAULT);
uv_stop(loop);
return 0; return 0;
} }