
2 Sep
2014
2 Sep
'14
6:59 a.m.
On Mon, Sep 1, 2014 at 7:13 PM, John Lato
So what should happen in your situation is that, when a separate thread closes the fd, threadWaitRead will throw an exception promptly, not continue to wait on a now-closed fd.
Right, which is what would happen most of the time. But in the race condition I'm pointing out, the thread yields *before* the call to threadWaitRead, so there is no interest yet registered in the file descriptor, so closeFdWith does not raise an exception. When the thread that calls threadWaitRead is resumed, it ends up waiting on an entirely different descriptor that happens to share the same index as the old descriptor. Best, Leon