Re: [Haskell-cafe] non-blocking Socket

2006-12-06 Thread Ian Lynagh
On Mon, Nov 13, 2006 at 12:44:05PM -0800, Donn Cave wrote:
 
 Threads, maybe?  Is blocking I/O seriously incompatible with the GHC
 threading model (or one of the models)?

The problem is that a blocking IO call would block all threads. We could
execute all such calls in their own OS thread, but that would be
expensive. There is a bug about not using blocking IO:
http://hackage.haskell.org/trac/ghc/ticket/724
but I don't think there's a plan for what to do instead yet.

 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?

The same problems occur, yes. If you want it to use an OS thread then
use the threadsafe safety modifier on the foreign import declarations.


Thanks
Ian

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] non-blocking Socket

2006-11-13 Thread Donn Cave
[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?

thanks,
Donn Cave, [EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe