[commit: ghc] master: Changelog entry and /Since/ for alloc-counter ops (8e82857)
git at git.haskell.org
git at git.haskell.org
Mon Nov 24 21:49:48 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/8e8285707605bdb3eb77f202733017b25693ccbe/ghc
>---------------------------------------------------------------
commit 8e8285707605bdb3eb77f202733017b25693ccbe
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Mon Nov 24 22:32:23 2014 +0100
Changelog entry and /Since/ for alloc-counter ops
See b0534f78a73f972e279eed4447a5687bd6a8308e for more details
[skip ci]
>---------------------------------------------------------------
8e8285707605bdb3eb77f202733017b25693ccbe
libraries/base/GHC/Conc/Sync.hs | 6 ++++++
libraries/base/GHC/IO/Exception.hs | 2 ++
libraries/base/changelog.md | 9 +++++++++
3 files changed, 17 insertions(+)
diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs
index 777fb71..e1dc915 100644
--- a/libraries/base/GHC/Conc/Sync.hs
+++ b/libraries/base/GHC/Conc/Sync.hs
@@ -193,6 +193,7 @@ instance Ord ThreadId where
--
-- Allocation accounting is accurate only to about 4Kbytes.
--
+-- /Since: 4.8.0.0/
setAllocationCounter :: Int64 -> IO ()
setAllocationCounter i = do
ThreadId t <- myThreadId
@@ -200,6 +201,8 @@ setAllocationCounter i = do
-- | Return the current value of the allocation counter for the
-- current thread.
+--
+-- /Since: 4.8.0.0/
getAllocationCounter :: IO Int64
getAllocationCounter = do
ThreadId t <- myThreadId
@@ -224,12 +227,15 @@ getAllocationCounter = do
-- Compared to using timeouts, allocation limits don't count time
-- spent blocked or in foreign calls.
--
+-- /Since: 4.8.0.0/
enableAllocationLimit :: IO ()
enableAllocationLimit = do
ThreadId t <- myThreadId
rts_enableThreadAllocationLimit t
-- | Disable allocation limit processing for the current thread.
+--
+-- /Since: 4.8.0.0/
disableAllocationLimit :: IO ()
disableAllocationLimit = do
ThreadId t <- myThreadId
diff --git a/libraries/base/GHC/IO/Exception.hs b/libraries/base/GHC/IO/Exception.hs
index d0a21b2..f811e5a 100644
--- a/libraries/base/GHC/IO/Exception.hs
+++ b/libraries/base/GHC/IO/Exception.hs
@@ -102,6 +102,8 @@ instance Show Deadlock where
-- |This thread has exceeded its allocation limit. See
-- 'GHC.Conc.setAllocationCounter' and
-- 'GHC.Conc.enableAllocationLimit'.
+--
+-- /Since: 4.8.0.0/
data AllocationLimitExceeded = AllocationLimitExceeded
deriving Typeable
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index df3d9d4..df20a58 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -119,6 +119,15 @@
* New module `GHC.RTS.Flags` that provides accessors to runtime flags.
+ * Expose functions for per-thread allocation counters and limits in `GHC.Conc`
+
+ disableAllocationLimit :: IO ()
+ enableAllocationLimit :: IO ()
+ getAllocationCounter :: IO Int64
+ setAllocationCounter :: Int64 -> IO ()
+
+ together with a new exception `AllocationLimitExceeded`.
+
## 4.7.0.1 *Jul 2014*
* Bundled with GHC 7.8.3
More information about the ghc-commits
mailing list