RE: [Haskell-cafe] Unbound threads and FFI

On 14 December 2005 14:37, Joel Reymont wrote:
How do unbound threads play with FFI? According to Simon PJ, each foreign call will get its own OS thread if its blocked.
How does GHC determine if the call is blocked? Does each call get its own OS thread from the start? Sometime later?
When a thread exits Haskell to make an FFI call, another OS thread takes over running the other Haskell threads. If we don't have another OS thread available, we start one.
Does this depend on the safe/unsafe specs of the foreign call?
this only happens for safe calls, not unsafe.
Does the above change if a threaded/non-threaded runtime is in use?
this only happens in the -threaded RTS, in the non-threaded RTS a FFI call will block all the other Haskell threads. Cheers, Simon

On Dec 14, 2005, at 3:21 PM, Simon Marlow wrote:
this only happens in the -threaded RTS, in the non-threaded RTS a FFI call will block all the other Haskell threads.
Just to be absolutely sure... Does the above apply to safe _and_ unsafe FFI? I have been using the non-threaded runtime with unsafe FFI calls (OpenSSL, Zlib) and I do not believe my runtime was being blocked. Maybe I just didn't notice it, though. -- http://wagerlabs.com/
participants (2)
-
Joel Reymont
-
Simon Marlow