libuv的三种运行模式(特别是UV_RUN_NOWAIT)

libuv的三种运行模式:

UV_RUN_DEFAULT: 默认轮询模式,此模式会一直运行事件循环直到没有活跃句柄、引用句柄、和请求句柄

UV_RUN_ONCE:一次轮询模式,处理一个事件。

UV_RUN_NOWAIT:一次轮询模式,最多处理一个事件。uv_run(loop, UV_RUN_NOWAIT) is similar to uv_run(loop, UV_RUN_ONCE) in that it will process only one event. UV_RUN_ONCE blocks if there are no pending events, while UV_RUN_NOWAIT will return immediately. We use NOWAIT so that one of the loops isn't starved because the other one has no pending activity.(UV_RUN_ONCE的意思是你想让我做件事儿,我就非要做一件,没有需要做的事儿的我就等着,也就是相信调用方告诉我有事儿就肯定会有)

原文地址:https://www.cnblogs.com/dongzhiquan/p/15213174.html