setNumCapabilities: don't barf() if it isn't supported, just print an error
authorSimon Marlow <marlowsd@gmail.com>
Fri, 6 Jan 2012 11:26:31 +0000 (11:26 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Fri, 6 Jan 2012 11:31:35 +0000 (11:31 +0000)
includes/rts/Threads.h
rts/Schedule.c

index 061e38b..dd533be 100644 (file)
@@ -61,10 +61,6 @@ extern Capability MainCapability;
 // Change the number of capabilities (only supports increasing the
 // current value at the moment).
 //
-#if defined(THREADED_RTS)
 extern void setNumCapabilities (nat new);
-#else
-extern void setNumCapabilities (nat new) GNU_ATTRIBUTE(__noreturn__);
-#endif
 
 #endif /* RTS_THREADS_H */
index 72b7217..ce10852 100644 (file)
@@ -1924,9 +1924,15 @@ void
 setNumCapabilities (nat new_n_capabilities USED_IF_THREADS)
 {
 #if !defined(THREADED_RTS)
-
-    barf("setNumCapabilities: not supported in the non-threaded RTS");
-
+    if (new_n_capabilities != 1) {
+        errorBelch("setNumCapabilities: not supported in the non-threaded RTS");
+    }
+    return;
+#elif defined(NOSMP)
+    if (new_n_capabilities != 1) {
+        errorBelch("setNumCapabilities: not supported on this platform");
+    }
+    return;
 #else
     Task *task;
     Capability *cap;