[commit: base] master: ioManagerCapabilitiesChanged takes no arguments and instead gets the current enabled number of capabilities by executing getNumCapabilities after it acquires a lock on the IO managers array. (ce09105)

Johan Tibell johan.tibell at gmail.com
Tue Feb 12 07:51:37 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/ce091054e6a3b6ce408c00fe3ef58d3269f15537

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

commit ce091054e6a3b6ce408c00fe3ef58d3269f15537
Author: Andreas Voellmy <andreas.voellmy at gmail.com>
Date:   Mon Jan 7 13:34:06 2013 -0500

    ioManagerCapabilitiesChanged takes no arguments and instead gets the current enabled number of capabilities by executing getNumCapabilities after it acquires a lock on the IO managers array.

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

 GHC/Conc/IO.hs      |    2 +-
 GHC/Event/Thread.hs |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/GHC/Conc/IO.hs b/GHC/Conc/IO.hs
index 98cdc61..c864fdc 100644
--- a/GHC/Conc/IO.hs
+++ b/GHC/Conc/IO.hs
@@ -79,7 +79,7 @@ ensureIOManagerIsRunning = Event.ensureIOManagerIsRunning
 ensureIOManagerIsRunning = Windows.ensureIOManagerIsRunning
 #endif
 
-ioManagerCapabilitiesChanged :: Int -> IO ()
+ioManagerCapabilitiesChanged :: IO ()
 #ifndef mingw32_HOST_OS
 ioManagerCapabilitiesChanged = Event.ioManagerCapabilitiesChanged
 #else
diff --git a/GHC/Event/Thread.hs b/GHC/Event/Thread.hs
index 2c8906e..0c91267 100644
--- a/GHC/Event/Thread.hs
+++ b/GHC/Event/Thread.hs
@@ -322,9 +322,10 @@ shutdownManagers =
 
 foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
 
-ioManagerCapabilitiesChanged :: Int -> IO ()
-ioManagerCapabilitiesChanged new_n_caps = do
+ioManagerCapabilitiesChanged :: IO ()
+ioManagerCapabilitiesChanged = do
   withMVar ioManagerLock $ \_ -> do
+    new_n_caps <- getNumCapabilities
     numEnabled <- readIORef numEnabledEventManagers
     writeIORef numEnabledEventManagers new_n_caps
     eventManagerArray <- readIORef eventManager





More information about the ghc-commits mailing list