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.