On 08/01/2014 12:37 PM, Iñaki Baz Castillo wrote:
> 2014-08-01 12:29 GMT+02:00 Saúl Ibarra Corretgé <[email protected]>:
>> You can't. You don't know what the loop is going to do next while
>> running inside it. The event to be emitted is a global one, that is,
>> "hey, your application is about to end", it's not about a single handle.
> 
> 
> Before you can run uv_run(UV_RUN_ONCE) you must exit the same loop
> (which was running with UV_RUN_DEFAULT), right? So, assuming the loop
> is normally running, why don't you call a custom function
> close_my_loop() which properly closes all the handles and notifies the
> application or whatever?
> 
> Again, for me anything that ends the loop without closing all the
> handles is not a good design. Said that I'm not talking about Node
> since I do not know Node internals.
> 

The scenario is that you want to notify the user about the process going
away and give him one last chance. IIRC he can prevent the loop from
exiting by creating new handles in this event. But all that is beyond
the point. Bottom line is: not all applications are like yours, other
people have different needs, and there is no One True Design To Rule
Them All (TM).

-- 
Saúl Ibarra Corretgé
bettercallsaghul.com


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to