projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c497471
)
add numSparks :: IO Int (#4167)
author
Simon Marlow
<marlowsd@gmail.com>
Tue, 20 Jul 2010 15:38:58 +0000
(15:38 +0000)
committer
Simon Marlow
<marlowsd@gmail.com>
Tue, 20 Jul 2010 15:38:58 +0000
(15:38 +0000)
GHC/Conc.lhs
patch
|
blob
|
history
diff --git
a/GHC/Conc.lhs
b/GHC/Conc.lhs
index
d676a1a
..
0d17457
100644
(file)
--- a/
GHC/Conc.lhs
+++ b/
GHC/Conc.lhs
@@
-33,6
+33,7
@@
module GHC.Conc
, forkOnIO -- :: Int -> IO a -> IO ThreadId
, forkOnIOUnmasked
, numCapabilities -- :: Int
, forkOnIO -- :: Int -> IO a -> IO ThreadId
, forkOnIOUnmasked
, numCapabilities -- :: Int
+ , numSparks -- :: IO Int
, childHandler -- :: Exception -> IO ()
, myThreadId -- :: IO ThreadId
, killThread -- :: ThreadId -> IO ()
, childHandler -- :: Exception -> IO ()
, myThreadId -- :: IO ThreadId
, killThread -- :: ThreadId -> IO ()
@@
-265,6
+266,10
@@
numCapabilities = unsafePerformIO $ do
n <- peek n_capabilities
return (fromIntegral n)
n <- peek n_capabilities
return (fromIntegral n)
+-- | Returns the number of sparks currently in the local spark pool
+numSparks :: IO Int
+numSparks = IO $ \s -> case numSparks# s of (# s', n #) -> (# s', I# n #)
+
#if defined(mingw32_HOST_OS) && defined(__PIC__)
foreign import ccall "_imp__n_capabilities" n_capabilities :: Ptr CInt
#else
#if defined(mingw32_HOST_OS) && defined(__PIC__)
foreign import ccall "_imp__n_capabilities" n_capabilities :: Ptr CInt
#else