RE: Re[2]: [Haskell-cafe] Unbound threads and FFI

2005-12-16 Thread Simon Peyton-Jones
I've added a FAQ.

Simon

| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
| Simon Marlow
| Sent: 15 December 2005 09:26
| To: Bulat Ziganshin
| Cc: Haskell-Cafe Cafe
| Subject: RE: Re[2]: [Haskell-cafe] Unbound threads and FFI
| 
| On 14 December 2005 18:04, Bulat Ziganshin wrote:
| 
|  Hello Simon,
| 
|  Wednesday, December 14, 2005, 7:39:43 PM, you wrote:
| 
|  Do other Haskell threads get blocked during an FFI call?
| 
|| safeunsafe
|  --+
|   -threaded| NO  YES
|   no -threaded | YES YES
| 
|  there is also `threadsafe` specifier. i don't understand from the
docs
|  what it exactly means?
| 
|  ghc commentary says:
| 
|  To signal that you want an external call to be serviced by a
separate
|  OS thread, you have to add the attribute threadsafe to a foreign
|  import declaration, i.e.,
| 
|  foreign import bigComp threadsafe largeComputation :: Int - IO ()
| 
|  The distinction between 'safe' and thread-safe C calls is made so
that
|  we may call external functions that aren't re-entrant but may cause
a
|  GC to occur.
| 
|  The threadsafe attribute subsumes safe.
| 
| threadsafe is deprecated; it is currently exactly the same as safe.
We
| thought at one time that it would be useful to have the distinction,
but
| it turned out to be impractical to implement safe that wasn't also
| threadsafe.
| 
| Cheers,
|   Simon
| ___
| Haskell-Cafe mailing list
| Haskell-Cafe@haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: Re[2]: [Haskell-cafe] Unbound threads and FFI

2005-12-15 Thread Simon Marlow
On 14 December 2005 18:04, Bulat Ziganshin wrote:

 Hello Simon,
 
 Wednesday, December 14, 2005, 7:39:43 PM, you wrote:
 
 Do other Haskell threads get blocked during an FFI call?
 
   | safeunsafe
 --+
  -threaded| NO  YES
  no -threaded | YES YES
 
 there is also `threadsafe` specifier. i don't understand from the docs
 what it exactly means?
 
 ghc commentary says:
 
 To signal that you want an external call to be serviced by a separate
 OS thread, you have to add the attribute threadsafe to a foreign
 import declaration, i.e.,
 
 foreign import bigComp threadsafe largeComputation :: Int - IO ()
 
 The distinction between 'safe' and thread-safe C calls is made so that
 we may call external functions that aren't re-entrant but may cause a
 GC to occur.
 
 The threadsafe attribute subsumes safe.

threadsafe is deprecated; it is currently exactly the same as safe.  We
thought at one time that it would be useful to have the distinction, but
it turned out to be impractical to implement safe that wasn't also
threadsafe.

Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe