[Haskell-cafe] non-blocking Socket

Donn Cave donn at drizzle.com
Mon Nov 13 15:44:05 EST 2006

[reposted with improved subject]

I notice that the Socket returned by ghc Network.Socket (socket) has
been set non-blocking.  (Noticed empirically, not from documentation.)

The Network.Socket functions that use it, e.g., recv, are ready for
that, of course, but as a general rule, external functions that
expect a socket are very likely not.  So I hacked up a crude fcntl
call to undo the damage and restore my socket to normal default mode,
but it makes me wonder what moved the ghc library authors to depart
from common usage in this respect, and provide no obvious means for
the programmer to restore the normal mode?

Threads, maybe?  Is blocking I/O seriously incompatible with the GHC
threading model (or one of the models)?  If I have external library
functions that use socket I/O internally, e.g., an OpenLDAP interface,
that's effectively the same as a blocking socket created in Haskell,
so whatever problem with one is the same with the other, right?

	Donn Cave, donn at drizzle.com

More information about the Haskell-Cafe mailing list