@Araq I think my example didn't clearly show that the issue was that the decision to close the server socket happens "independently" from the code that accepts incoming connections. I've now move the "close code" in the same proc as the "open code" (as you suggested), and use regular polling on a volatile flag to tell the proc to terminate.
I don't remeber seeing that last "{.gcsafe.}:" syntax before. I think that
might solve some of my problems.
