[commit: ghc] master: setNumCapabilities calls GHC.Conc.IO.ioManagerCapabilitiesChanged before returning. (24733b8)

Johan Tibell johan.tibell at gmail.com
Tue Feb 12 07:49:23 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/24733b8f9bf27b2ebaf06a411a8bd95a01138651

>---------------------------------------------------------------

commit 24733b8f9bf27b2ebaf06a411a8bd95a01138651
Author: Andreas Voellmy <andreas.voellmy at gmail.com>
Date:   Sat Dec 22 19:38:21 2012 -0500

    setNumCapabilities calls GHC.Conc.IO.ioManagerCapabilitiesChanged before returning.
    
    This enables the IO manager to change the number of IO loops it uses (usually one per capability).

>---------------------------------------------------------------

 rts/Prelude.h       |    1 +
 rts/Schedule.c      |    8 ++++++++
 rts/package.conf.in |    1 +
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/rts/Prelude.h b/rts/Prelude.h
index e0b87e0..dcd7b94 100644
--- a/rts/Prelude.h
+++ b/rts/Prelude.h
@@ -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);
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 5f48ef6..7eaaba2 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -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
diff --git a/rts/package.conf.in b/rts/package.conf.in
index ee964db..3751513 100644
--- a/rts/package.conf.in
+++ b/rts/package.conf.in
@@ -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





More information about the ghc-commits mailing list