You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got to thinking about this due to the hoops that #1579 had to jump through. I've also occasionally encountered cases where I wanted to push a nursery into a background task and later spawn things into it, which currently requires an awkward dance with start().
The idea here would be:
You can construct a nursery just as trio.Nursery() with no arguments.
The tasks inside the nursery only run once it's bound to an async with block.
If you call start_soon() before the async with block is entered, the Task is still created but it's not added to the runq yet.
If you call start() before the async with block is entered, the new task starts up like normal, but blocks at its first checkpoint after started() until the target nursery is bound.
Is this a good idea at all? If so, are the above semantics the ones we would want?
I'm significantly less convinced this is a good idea for nurseries than that it is one for cancel scopes, especially because "what happens if no one ever binds the nursery?". But I wanted to throw it out there.
The text was updated successfully, but these errors were encountered:
If it was a good idea for cancel scopes (#607)...
I got to thinking about this due to the hoops that #1579 had to jump through. I've also occasionally encountered cases where I wanted to push a nursery into a background task and later spawn things into it, which currently requires an awkward dance with
start()
.The idea here would be:
trio.Nursery()
with no arguments.async with
block.start_soon()
before theasync with
block is entered, theTask
is still created but it's not added to the runq yet.start()
before theasync with
block is entered, the new task starts up like normal, but blocks at its first checkpoint afterstarted()
until the target nursery is bound.Is this a good idea at all? If so, are the above semantics the ones we would want?
I'm significantly less convinced this is a good idea for nurseries than that it is one for cancel scopes, especially because "what happens if no one ever binds the nursery?". But I wanted to throw it out there.
The text was updated successfully, but these errors were encountered: