[commit: ghc] master: Update comment about C helper for foreign exports (#9713) (ddb484c)

git at git.haskell.org git at git.haskell.org
Tue Nov 18 18:21:48 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ddb484c2335c75f8fd767f54377e418db400aede/ghc

>---------------------------------------------------------------

commit ddb484c2335c75f8fd767f54377e418db400aede
Author: Bertram Felgenhauer <int-e at gmx.de>
Date:   Tue Nov 18 12:15:33 2014 -0600

    Update comment about C helper for foreign exports (#9713)
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

ddb484c2335c75f8fd767f54377e418db400aede
 compiler/deSugar/DsForeign.lhs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs
index c60e914..311069e 100644
--- a/compiler/deSugar/DsForeign.lhs
+++ b/compiler/deSugar/DsForeign.lhs
@@ -398,12 +398,16 @@ f cback =
 
 foreign import "&f_helper" f_helper :: FunPtr (StablePtr Fun -> Fun)
 
--- and the helper in C:
+-- and the helper in C: (approximately; see `mkFExportCBits` below)
 
 f_helper(StablePtr s, HsBool b, HsInt i)
 {
-        rts_evalIO(rts_apply(rts_apply(deRefStablePtr(s),
+        Capability *cap;
+        cap = rts_lock();
+        rts_evalIO(&cap,
+                   rts_apply(rts_apply(deRefStablePtr(s),
                                        rts_mkBool(b)), rts_mkInt(i)));
+        rts_unlock(cap);
 }
 \end{verbatim}
 



More information about the ghc-commits mailing list