[Haskell-cafe] non-blocking Socket

Ian Lynagh igloo at earth.li
Wed Dec 6 10:23:56 EST 2006


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



More information about the Haskell-Cafe mailing list