2014-08-01 11:10 GMT+02:00 Saúl Ibarra Corretgé <[email protected]>: > On 08/01/2014 10:57 AM, Iñaki Baz Castillo wrote: >> 2014-08-01 10:44 GMT+02:00 Saúl Ibarra Corretgé <[email protected]>: >>> If you have a timer that kicks in 100ms, UV_RUN_ONCE will block for >>> 100ms. What I showed was an example. >> >> Same as if you close the timer in its first callback (and that is even >> better than using UV_RUN_ONCE since you can free the timer handle and >> the entire loop without having to iterate all of them and call >> uv_close for later run again uv_run to execute their close callbacks). >> > > No sure what you are trying to explain. Close callbacks behave the same > no matter how you run the loop. Actually, if you close the timer in its > callback, it will be called on that same iteration, as the last step.
So if you run UV_RUN_ONCE having a timer then it will exit at first execution (plus its close callback if invoked). But if you forgot that you also have a running TCP server or UDP socket then it will block forever. That sounds sad IMHO. I've never needed UV_RUN_ONCE nor UV_RUN_NOWAIT. I consider them bad ways (workarounds) for semi-closing a loop. Do you want to exit the loop? Have a proper xxxx_close() custom function that properly closes all the handles. If you do not have control over your running handles then your fault so fix your code. -- Iñaki Baz Castillo <[email protected]> -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
