lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Feb 19, 2009, at 7:25 AM, Roberto Ierusalimschy wrote:

Do upvalues get processed when a coroutine gets collected?

Currently no.

Does a closure keep the coroutine in which it was created from being
collected? If not, then isn't there a problem if upvalues don't get
closed when the coroutine gets collected? Or maybe we miscommunicated
since I failed to say "closed" in my earlier message.

I understood what you said, the wrong answer was all my fault; sorry.
upvalues *do* get closed when a coroutine gets collected (see
'luaE_freethread'). (Otherwise, as you said, there would be problems.)

So, a finalization design based on an extension to the upvalue mechanism would handle coroutines that will never be resumed, but not any more efficiently than the __gc methods on the corresponding items.

In other words, the design seems tenable but that leaves the question of whether it is worth the trouble.