Thanks, good stuff. One question:
Note that cancel()
is a synchronous function, only queueing a request to cancel the nursery. It won't propagate until the code calling cancel()
yields execution.
Why was it done that way? Would it have been possible to just have cancel() throw an exception to immediately stop the child task? I'm thinking this might lead to surprising behavior because (IIUC) calling cancel won't interrupt the thread and so subsequent code will still get executed, e.g.
if not should_launch_missles then
nursery.cancel()
end
launch_missles()
David