Add warning comment about Mach-O section name hack.
[ghc.git] / rts / RtsAPI.c
index ec19b16..720b732 100644 (file)
@@ -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);