lua-users home
lua-l archive

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


On Mon, Sep 26, 2022 at 1:41 AM Jorge Visca <xxopxe@gmail.com> wrote:
After some (rather murky) thinking, I believe that the natural behavior
for a "task" going out of scope is to be killed right away.

To clarify first: if the nursery scope exits by exception, the children will be cancelled.  (The code posted so far doesn't quite implement this properly, but that's coming next.)  So what you mention is regarding the non-error case.

From experience using nurseries for over 3 years in a large, production, Python app:  cancelling children on non-error scope exit is not the desired semantics, 95% of the time.  The articles haven't delved into the practical uses of nurseries, so I can understand this not being evident.  Fortunately, the nursery API will have a cancel method (also not yet implemented), which can be called just before the end of the scope, if that's the needed behavior.