OK, I see, sure, for the accept loop, hard cancellation and GS are the same. But say I have a signal handler up at the top of my call tree that wants to GS my whole program. How does it find all the accept loops in order to send them a hard cancellation?
This is what I was trying to get at in a previous message… Imagine we could write something like:
with upgrade_graceful_cancel_to_hard_cancel:
while True:
conn = listener.accept()
nursery.start_soon(handler, conn)
Now our signal handler can send a GS to the whole program, and each accept
loop upgrades incoming GS into a hard cancel. The point is: now signal handler doesn’t have to know about the accept
loops, or vice-versa.
This is also an issue, but if we have a mechanism for the signal handler to talk to the accept loop, then I guess we can re-use it to let the signal handler talk to the individual WS coroutines too?
Unfortunately no