[Haskell-cafe] Unbound threads and FFI

John Meacham john at repetae.net
Thu Dec 15 19:39:19 EST 2005


On Wed, Dec 14, 2005 at 04:39:43PM -0000, Simon Marlow wrote:
> Do other Haskell threads get blocked during an FFI call?
> 
>               | safe    unsafe
> --------------+----------------
>  -threaded    | NO      YES
>  no -threaded | YES     YES

this is part of the reason I'd like to see a separate 'blockable'
specifier allowed on foreign imports. so that one can write portable
thread-safe libraries. right now, if one want's to call something like 
gethostbyname(3), they must call it with 'safe' so every implementation
has to pay the price of a safe call even though it is only there so ghc
won't block. (or #ifdefs, which are anoying) if blockable were separate
then it can be declared 'blockable unsafe' and ghc will interpret that
as 'safe' while non-threaded implementations will interpret it as
'unsafe' and everyone is happy.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Haskell-Cafe mailing list