setNumCapabilities calls GHC.Conc.IO.ioManagerCapabilitiesChanged before returning.
authorAndreas Voellmy <andreas.voellmy@gmail.com>
Sun, 23 Dec 2012 00:38:21 +0000 (19:38 -0500)
committerJohan Tibell <johan.tibell@gmail.com>
Tue, 12 Feb 2013 05:38:36 +0000 (21:38 -0800)
This enables the IO manager to change the number of IO loops it uses (usually one per capability).

rts/Prelude.h
rts/Schedule.c
rts/package.conf.in

index e0b87e0..dcd7b94 100644 (file)
@@ -45,6 +45,7 @@ PRELUDE_CLOSURE(base_ControlziExceptionziBase_nestedAtomically_closure);
 
 PRELUDE_CLOSURE(base_GHCziConcziSync_runSparks_closure);
 PRELUDE_CLOSURE(base_GHCziConcziIO_ensureIOManagerIsRunning_closure);
+PRELUDE_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure);
 PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlers_closure);
 
 PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles_closure);
index 5f48ef6..7eaaba2 100644 (file)
@@ -2067,6 +2067,14 @@ setNumCapabilities (nat new_n_capabilities USED_IF_THREADS)
         stgFree(old_capabilities);
     }
 
+    // Notify IO manager that the number of capabilities has changed.
+    rts_evalIO(
+       &cap,
+       rts_apply(cap, 
+                &base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure,
+                rts_mkInt(cap, enabled_capabilities)),
+       NULL);
+
     rts_unlock(cap);
 
 #endif // THREADED_RTS
index ee964db..3751513 100644 (file)
@@ -101,6 +101,7 @@ ld-options:
          , "-u", "_base_GHCziTopHandler_runIO_closure"
          , "-u", "_base_GHCziTopHandler_runNonIO_closure"
         , "-u", "_base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
+         , "-u", "_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
         , "-u", "_base_GHCziConcziSync_runSparks_closure"
         , "-u", "_base_GHCziConcziSignal_runHandlers_closure"
 #else