[Haskell-cafe] simple servers

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Thu Sep 20 05:24:10 CEST 2012


>> All system calls issued from the network package use non-blocking.
>> You don't have to worry about blocking at all.
> 
> Almost.  Especially when interfacing with C code you should include the
> "-threaded" option to GHC to link against the multi-threaded run-time
> system.  Otherwise your Haskell code will block your C code and
> vice-versa.  Also some concurrency features don't work properly in the
> single-threaded run-time.

Non-threaded RTS would block FFI to C code. But it does not block file
descriptors and sockets because the scheduler uses select(). To my
experience, *simple* network programming with non-threaded RTS also
works well except the case where we reach the limit of file
descriptors for the process.

Anyway, I recommend to specify the "-threaded" option to GHC for
network programming if you don't have special reasons.

--Kazu



More information about the Haskell-Cafe mailing list