[Mono-devel-list] Re: [Mono-patches] r44192 - trunk/mcs/class/System/System.Net.Sockets

Dick Porter dick at ximian.com
Tue May 10 09:23:15 EDT 2005


On Mon, 2005-05-09 at 16:52 -0600, Gonzalo Paniagua Javier wrote:
> On Mon, 2005-05-09 at 09:07 +0100, Dick Porter wrote:
> > Given how fragile thread aborting is, even without this race condition
> > this might get ugly.  I can't think of a better solution offhand
> > though...
> 
> Did you see the C test case in the bug report? There seems to be no
> other way of closing from one thread if other is accepting than through
> a signal that interrupts the call.

I didn't look at it before, but have now.

One possible answer might be to put the socket into non-blocking mode
while it is accept()ing.  accept() then returns EAGAIN (or EWOULDBLOCK)
when there are no connections ready to be accepted, and EBADF when the
socket closes.  I've attached a new version of your C test (I think you
should have been waiting for cond2 in the poll test too, but it didn't
seem to make any difference.)

We would have to make sure to track the requested blocking state.

- Dick






More information about the Mono-devel-list mailing list