[commit: packages/stm] master: Add `@since` annotations (33238be)
git at git.haskell.org
git at git.haskell.org
Wed Dec 17 10:48:28 UTC 2014
Repository : ssh://git@git.haskell.org/stm
On branch : master
Link : http://git.haskell.org/packages/stm.git/commitdiff/33238be50b8e7a18c0d39c4fefaf623763c41c4a
>---------------------------------------------------------------
commit 33238be50b8e7a18c0d39c4fefaf623763c41c4a
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Wed Dec 17 11:40:36 2014 +0100
Add `@since` annotations
>---------------------------------------------------------------
33238be50b8e7a18c0d39c4fefaf623763c41c4a
Control/Concurrent/STM/TBQueue.hs | 5 +++++
Control/Concurrent/STM/TChan.hs | 6 ++++++
Control/Concurrent/STM/TMVar.hs | 2 ++
Control/Concurrent/STM/TQueue.hs | 3 +++
Control/Concurrent/STM/TSem.hs | 2 ++
Control/Concurrent/STM/TVar.hs | 2 ++
6 files changed, 20 insertions(+)
diff --git a/Control/Concurrent/STM/TBQueue.hs b/Control/Concurrent/STM/TBQueue.hs
index 00a7b51..bfe4a6b 100644
--- a/Control/Concurrent/STM/TBQueue.hs
+++ b/Control/Concurrent/STM/TBQueue.hs
@@ -24,6 +24,7 @@
-- queue representation that uses two lists to obtain amortised /O(1)/
-- enqueue and dequeue operations.
--
+-- @since 2.4
-----------------------------------------------------------------------------
module Control.Concurrent.STM.TBQueue (
@@ -47,6 +48,8 @@ import GHC.Conc
#define _UPK_(x) {-# UNPACK #-} !(x)
-- | 'TBQueue' is an abstract type representing a bounded FIFO channel.
+--
+-- @since 2.4
data TBQueue a
= TBQueue _UPK_(TVar Int) -- CR: read capacity
_UPK_(TVar [a]) -- R: elements waiting to be read
@@ -180,6 +183,8 @@ isEmptyTBQueue (TBQueue _rsize read _wsize write) = do
_ -> return False
-- |Returns 'True' if the supplied 'TBQueue' is full.
+--
+-- @since 2.4.3
isFullTBQueue :: TBQueue a -> STM Bool
isFullTBQueue (TBQueue rsize _read wsize _write) = do
w <- readTVar wsize
diff --git a/Control/Concurrent/STM/TChan.hs b/Control/Concurrent/STM/TChan.hs
index 8ca1734..af06fb4 100644
--- a/Control/Concurrent/STM/TChan.hs
+++ b/Control/Concurrent/STM/TChan.hs
@@ -95,6 +95,8 @@ newTChanIO = do
-- it is only written to and never read, items will pile up in memory. By
-- using 'newBroadcastTChan' to create the broadcast channel, items can be
-- garbage collected after clients have seen them.
+--
+-- @since 2.4
newBroadcastTChan :: STM (TChan a)
newBroadcastTChan = do
write_hole <- newTVar TNil
@@ -103,6 +105,8 @@ newBroadcastTChan = do
return (TChan read write)
-- | @IO@ version of 'newBroadcastTChan'.
+--
+-- @since 2.4
newBroadcastTChanIO :: IO (TChan a)
newBroadcastTChanIO = do
write_hole <- newTVarIO TNil
@@ -189,6 +193,8 @@ isEmptyTChan (TChan read _write) = do
-- |Clone a 'TChan': similar to dupTChan, but the cloned channel starts with the
-- same content available as the original channel.
+--
+-- @since 2.4
cloneTChan :: TChan a -> STM (TChan a)
cloneTChan (TChan read write) = do
readpos <- readTVar read
diff --git a/Control/Concurrent/STM/TMVar.hs b/Control/Concurrent/STM/TMVar.hs
index 932d4ca..e9477df 100644
--- a/Control/Concurrent/STM/TMVar.hs
+++ b/Control/Concurrent/STM/TMVar.hs
@@ -156,6 +156,8 @@ isEmptyTMVar (TMVar t) = do
-- | Make a 'Weak' pointer to a 'TMVar', using the second argument as
-- a finalizer to run when the 'TMVar' is garbage-collected.
+--
+-- @since 2.4.4
mkWeakTMVar :: TMVar a -> IO () -> IO (Weak (TMVar a))
mkWeakTMVar tmv@(TMVar (TVar t#)) f = IO $ \s ->
case mkWeak# t# tmv f s of (# s1, w #) -> (# s1, Weak w #)
diff --git a/Control/Concurrent/STM/TQueue.hs b/Control/Concurrent/STM/TQueue.hs
index 0b13ccd..c5c6cc6 100644
--- a/Control/Concurrent/STM/TQueue.hs
+++ b/Control/Concurrent/STM/TQueue.hs
@@ -28,6 +28,7 @@
-- queue representation that uses two lists to obtain amortised /O(1)/
-- enqueue and dequeue operations.
--
+-- @since 2.4
-----------------------------------------------------------------------------
module Control.Concurrent.STM.TQueue (
@@ -49,6 +50,8 @@ import GHC.Conc
import Data.Typeable (Typeable)
-- | 'TQueue' is an abstract type representing an unbounded FIFO channel.
+--
+-- @since 2.4
data TQueue a = TQueue {-# UNPACK #-} !(TVar [a])
{-# UNPACK #-} !(TVar [a])
deriving Typeable
diff --git a/Control/Concurrent/STM/TSem.hs b/Control/Concurrent/STM/TSem.hs
index 53f7f05..8f1d565 100644
--- a/Control/Concurrent/STM/TSem.hs
+++ b/Control/Concurrent/STM/TSem.hs
@@ -10,6 +10,7 @@
--
-- 'TSem': transactional semaphores.
--
+-- @since 2.4.2
-----------------------------------------------------------------------------
{-# LANGUAGE DeriveDataTypeable #-}
@@ -34,6 +35,7 @@ import Data.Typeable
-- resource. However, like other STM abstractions, 'TSem' is
-- composable.
--
+-- @since 2.4.2
newtype TSem = TSem (TVar Int)
deriving (Eq, Typeable)
diff --git a/Control/Concurrent/STM/TVar.hs b/Control/Concurrent/STM/TVar.hs
index 41888d4..709a7ca 100644
--- a/Control/Concurrent/STM/TVar.hs
+++ b/Control/Concurrent/STM/TVar.hs
@@ -73,6 +73,8 @@ swapTVar var new = do
-- | Make a 'Weak' pointer to a 'TVar', using the second argument as
-- a finalizer to run when 'TVar' is garbage-collected
+--
+-- @since 2.4.3
mkWeakTVar :: TVar a -> IO () -> IO (Weak (TVar a))
mkWeakTVar t@(TVar t#) f = IO $ \s ->
case mkWeak# t# t f s of (# s1, w #) -> (# s1, Weak w #)
More information about the ghc-commits
mailing list