summaryrefslogtreecommitdiff
path: root/rts/RtsAPI.c
diff options
context:
space:
mode:
authorNicolas Frisby <nicolas.frisby@gmail.com>2013-08-22 15:00:41 -0500
committerNicolas Frisby <nicolas.frisby@gmail.com>2013-08-22 15:00:54 -0500
commit84f9927c1a04b8e35b97101771d8f6d625643d9b (patch)
tree050d7265a24fa1ff9aecc4081bb01bc444520587 /rts/RtsAPI.c
parent2eaf46fb1bb8c661c03f3e5e80622207ef2509d9 (diff)
parentc24be4b761df558d9edc9c0b1554bb558c261b14 (diff)
downloadhaskell-late-dmd.tar.gz
merged master into late-dmdlate-dmd
Diffstat (limited to 'rts/RtsAPI.c')
-rw-r--r--rts/RtsAPI.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c
index ec19b169b6..720b732323 100644
--- a/rts/RtsAPI.c
+++ b/rts/RtsAPI.c
@@ -522,7 +522,16 @@ rts_checkSchedStatus (char* site, Capability *cap)
stg_exit(EXIT_FAILURE);
case Interrupted:
errorBelch("%s: interrupted", site);
- stg_exit(EXIT_FAILURE);
+#ifdef THREADED_RTS
+ // The RTS is shutting down, and the process will probably
+ // soon exit. We don't want to preempt the shutdown
+ // by exiting the whole process here, so we just terminate the
+ // current thread. Don't forget to release the cap first though.
+ rts_unlock(cap);
+ shutdownThread();
+#else
+ stg_exit(EXIT_FAILURE);
+#endif
default:
errorBelch("%s: Return code (%d) not ok",(site),(rc));
stg_exit(EXIT_FAILURE);