[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A note on automatic resource management
- From: Florian Weimer <fw@...>
- Date: Sun, 23 May 2010 12:57:16 +0200
* steve donovan:
>> If you have got an event loop, you can run them from the event loop
>> with very little risk.
>
> Non-trivial applications usually have one, so that's cool, but what
> kind of finalization mechanism could exploit this reliably?
This is probably my fault because I waited too long for replying. If
you go back to the original message, finalization in this way happens
only if a coroutine which has pending destructors (scope exit
handlers) becomes unreferenced. I expect this happen only in odd
cases (some execution is abandoned because an error occurred, or
someone poked around with a debugger). It's just a safety net,
similar to finalization in Java, where correct code should always use
try-finally blocks.