Waiting on Sockets or File Descriptors

Peter Simons simons at cryp.to
Thu Feb 3 18:58:25 EST 2005


Simon Marlow writes:

 > When you compile your program with -threaded, "safe" FFI
 > calls don't block other threads, but "unsafe" calls still
 > do. Basically a "safe" FFI call releases the lock on the
 > RTS so other Haskell threads can continue to run [...].

Thanks for the clarification.

If I understood this right, then I can use forkIO to run a
"safe" FFI function which blocks, but in the threaded RTS
this will not block all other FFI calls.

So what happens in the non-threaded RTS? Now the blocking
yet "safe" FFI invocation _would_ block other FFI calls but
not evaluation of "pure Haskell" code. Is that right?

Peter



More information about the Glasgow-haskell-users mailing list