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的意思是你想讓我做件事兒,我就非要做一件,沒有需要做的事兒的我就等着,也就是相信調用方告訴我有事兒就肯定會有)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM