lua-users home
lua-l archive

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


On Fri, Jul 31, 2020 at 9:41 PM Dibyendu Majumdar wrote:
If the thread is never resumed, it is impossible to invoke the close
method

Assume we have an hierarchy of nested objects:
- VM
- coroutine
- do-end block
- to-be-closed variable holding allocated resource

The "scope exiting event" means exiting from the immediate parent.
The "coroutine death/collection event" means exiting from the grandparent.
The "VM closing event" means exiting from great grandparent.

If a coroutine is never resumed, we will not receive the innermost event,
but we will receive at least one of the outer events.
All three types of events should be involved in the resource-closing-logic.