'accept' does not seem to be thread friendly ..

Simon Marlow simonmar@microsoft.com
Tue, 3 Dec 2002 09:59:06 -0000


> Below is my sample code ; the Net Cats
> This does not work, because 'accept' fuction of the
> Network module blocks the whole process, unlike
> Haskell Standard IO functions which blocks its thread
> only. How did you work around with complex networked
> applications ? It would be very helpful if you could
> give us more detailed advice from your expierience.
>=20
> Network.accept does not seem to be thread friendly.
> Then how am I going to keep my server from being blocked
> by accept?

I'm not sure exactly what your program is supposed to be doing, but as
far as I can tell it's working fine :-)

While the accept is waiting for a connection, the thread doing the
accept has taken the MVar, thus blocking the other thread which is also
trying to take the MVar.  I think this is perhaps not what you had in
mind?

Cheers,
	Simon