> 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 still don't get it. That how it works *by design*. libuv can't guess
that you only wanted the timer to fire. If you use UV_RUN_ONCE you need
to know why. Do we need better docs for it? Probably.

> 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.
> 

Again, it's *your* experience, not everyone else's. As an example, Node
uses UV_RUN_ONCE, in order to be able to emit an event just before the
loop is going to exit and thus execution will finish. You can't do that
with UV_RUN_DEFAULT.

-- 
Saúl Ibarra Corretgé
bettercallsaghul.com


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to