summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertram Felgenhauer <int-e@gmx.de>2014-11-18 12:15:33 -0600
committerAustin Seipp <austin@well-typed.com>2014-11-18 12:15:33 -0600
commitddb484c2335c75f8fd767f54377e418db400aede (patch)
tree7734128db7fc75e473c8278a230c08675a95b48f
parent1f6b1ab4b6d7203481bfaf374b014972f7756fb2 (diff)
downloadhaskell-ddb484c2335c75f8fd767f54377e418db400aede.tar.gz
Update comment about C helper for foreign exports (#9713)
Signed-off-by: Austin Seipp <austin@well-typed.com>
-rw-r--r--compiler/deSugar/DsForeign.lhs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs
index c60e9146bc..311069ec67 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}