On 26/01/2011 11:15, Roman Leshchinskiy wrote:
Simon Peyton-Jones wrote:


|  AFAIK, the GC never runs during foreign calls. This, combine with the
fact that GHC can |  pass ByteArray# directly to FFI calls, should make
memcpy safe even for unpinned |  byte arrays. At least that's how I
understand it.

Unless I am much mistaken, GC absolutely does run during *safe* foreign
calls, as do other Haskell threads and all manner of other stuff.
("Unsafe" ones are supposed to run fast, and no gc is allowed. We think
of unsafe foreign calls as "fat machine instructions".)

I don't think the GC can run even during a safe foreign call while the
thread is in foreign code. It's only when the foreign code calls back into
Haskell that allocation and hence synchronised GC can happen.

No - as soon as the thread enters foreign code via a safe foreign call, GC can happen at any time.

Cheers,
        Simon

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to