fix potential deadlock where rapid sends & recvs could trample each other's signals
windows: fix race condition in wait