On Wed, 25 Apr 2018 02:24:15 -0700 Nathaniel Smith firstname.lastname@example.org wrote:
I just posted another essay on concurrent API design:
This is the one that finally gets at the core reasons why Trio exists; I've been trying to figure out how to write it for at least a year now. I hope you like it.
My experience is indeed that something like the nursery construct would make concurrent programming much more robust in complex cases. This is a great explanation why.
API note: I would expect to be able to use it this way:
def __init__(self): self._nursery = open_nursery()
# Lots of behaviour methods that can put new tasks in the nursery
def close(self): self._nursery.close()
Also perhaps more finegrained shutdown routines such as:
wait for all tasks to join, cancel the remaining ones after the given timeout