summaryrefslogtreecommitdiff
path: root/rts/RtsAPI.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-05-05 11:49:47 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-05-05 11:49:47 +0000
commit497f8aa6c2c8770daf3d39f57ee5e04dcdcc3778 (patch)
tree977b2376b794783041e795ee69f69765bf86ca86 /rts/RtsAPI.c
parent7f148c3265edb930223f50c3702e33bc51f00bd1 (diff)
downloadhaskell-497f8aa6c2c8770daf3d39f57ee5e04dcdcc3778.tar.gz
Make the running_finalizers flag task-local
Fixes a bug reported by Lennart Augustsson, whereby we could get an incorrect error from the RTS about re-entry from a finalizer,
Diffstat (limited to 'rts/RtsAPI.c')
-rw-r--r--rts/RtsAPI.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c
index 6e6621841e..2479f2038a 100644
--- a/rts/RtsAPI.c
+++ b/rts/RtsAPI.c
@@ -538,7 +538,9 @@ rts_lock (void)
Capability *cap;
Task *task;
- if (running_finalizers) {
+ task = newBoundTask();
+
+ if (task->running_finalizers) {
errorBelch("error: a C finalizer called back into Haskell.\n"
" This was previously allowed, but is disallowed in GHC 6.10.2 and later.\n"
" To create finalizers that may call back into Haskell, use\n"
@@ -546,8 +548,6 @@ rts_lock (void)
stg_exit(EXIT_FAILURE);
}
- task = newBoundTask();
-
cap = NULL;
waitForReturnCapability(&cap, task);
return (Capability *)cap;