[Haskell] Re: ANN: HDBC (Haskell Database Connectivity)

Bulat Ziganshin bulatz at HotPOP.com
Thu Jan 5 05:39:54 EST 2006

Hello John,

Wednesday, January 04, 2006, 10:13:00 PM, you wrote:

>> I saw that you are using unsafe foreign imports everywhere in
>> Database.HDBC.PostgreSQL. The trouble with them is that all Haskell
>> threads will be suspended during the call.

it is from Haskell-Cafe:

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 Meacham - ?repetae.net?john? 

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell mailing list