[commit: base] : Replace use of numCapabilities with getNumCapabilities. (15d1571)

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


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

On branch  : 

http://hackage.haskell.org/trac/ghc/changeset/15d1571d6ba7c3fdf2048a3f85103a8c8d18d676

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

commit 15d1571d6ba7c3fdf2048a3f85103a8c8d18d676
Author: Andreas Voellmy <andreas.voellmy at gmail.com>
Date:   Sat Dec 22 20:19:58 2012 -0500

    Replace use of numCapabilities with getNumCapabilities.
    
    Prepares the way for supporting changing number of capabilities.

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

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

diff --git a/GHC/Event/Thread.hs b/GHC/Event/Thread.hs
index bef907c..d0b75fc 100644
--- a/GHC/Event/Thread.hs
+++ b/GHC/Event/Thread.hs
@@ -25,7 +25,7 @@ import Foreign.Ptr (Ptr)
 import GHC.Base
 import GHC.Conc.Sync (TVar, ThreadId, ThreadStatus(..), atomically, forkIO,
                       labelThread, modifyMVar_, withMVar, newTVar, sharedCAF,
-                      numCapabilities, threadCapability, myThreadId, forkOn,
+                      getNumCapabilities, threadCapability, myThreadId, forkOn,
                       threadStatus, writeTVar, newTVarIO, readTVar, retry,throwSTM,STM)
 import GHC.IO (mask_, onException)
 import GHC.IO.Exception (ioError)
@@ -175,7 +175,8 @@ foreign import ccall unsafe "getOrSetSystemEventThreadEventManagerStore"
 
 eventManager :: IORef (IOArray Int (Maybe (ThreadId, EventManager)))
 eventManager = unsafePerformIO $ do
-    eventManagerArray <- newIOArray (0, numCapabilities - 1) Nothing
+    numCaps <- getNumCapabilities
+    eventManagerArray <- newIOArray (0, numCaps - 1) Nothing
     em <- newIORef eventManagerArray
     sharedCAF em getOrSetSystemEventThreadEventManagerStore
 {-# NOINLINE eventManager #-}





More information about the ghc-commits mailing list