diff options
Diffstat (limited to 'Control/Concurrent')
-rw-r--r-- | Control/Concurrent/STM/UpdateStream.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Control/Concurrent/STM/UpdateStream.hs b/Control/Concurrent/STM/UpdateStream.hs index b01fc0bc..227ffef4 100644 --- a/Control/Concurrent/STM/UpdateStream.hs +++ b/Control/Concurrent/STM/UpdateStream.hs | |||
@@ -6,10 +6,10 @@ | |||
6 | -- Maintainer : joe@jerkface.net | 6 | -- Maintainer : joe@jerkface.net |
7 | -- Stability : experimental | 7 | -- Stability : experimental |
8 | -- | 8 | -- |
9 | -- An UpdateSream consists of pass-through messages that are queued up and | 9 | -- An UpdateStream consists of pass-through messages that are queued up and |
10 | -- slotted messages which might be obsoleted and discarded if they are not | 10 | -- slotted messages which might be obsoleted and discarded if they are not |
11 | -- consumed before newer slotted messages with the same slot value occur. | 11 | -- consumed before newer slotted messages with the same slot value occur. |
12 | -- | 12 | -- |
13 | -- Slots are implemented with "Control.Concurrent.STM.StatusCache" and it is | 13 | -- Slots are implemented with "Control.Concurrent.STM.StatusCache" and it is |
14 | -- recommended that you read that documentation first. | 14 | -- recommended that you read that documentation first. |
15 | -- | 15 | -- |
@@ -25,7 +25,7 @@ | |||
25 | -- > import Control.Concurrent (forkIO, threadDelay) | 25 | -- > import Control.Concurrent (forkIO, threadDelay) |
26 | -- > import System.IO (hFlush, stdout) | 26 | -- > import System.IO (hFlush, stdout) |
27 | -- > import qualified Control.Concurrent.STM.UpdateStream as Cache | 27 | -- > import qualified Control.Concurrent.STM.UpdateStream as Cache |
28 | -- > | 28 | -- > |
29 | -- > messages :: [(Maybe String, Char)] | 29 | -- > messages :: [(Maybe String, Char)] |
30 | -- > messages = concat | 30 | -- > messages = concat |
31 | -- > [ slot "x" "(set x = 2)" | 31 | -- > [ slot "x" "(set x = 2)" |
@@ -40,7 +40,7 @@ | |||
40 | -- > where | 40 | -- > where |
41 | -- > slot v cs = map ((,) (Just v)) cs | 41 | -- > slot v cs = map ((,) (Just v)) cs |
42 | -- > message cs = map ((,) Nothing) cs | 42 | -- > message cs = map ((,) Nothing) cs |
43 | -- > | 43 | -- > |
44 | -- > main = do | 44 | -- > main = do |
45 | -- > q <- atomically $ Cache.new (== '(') (==')') | 45 | -- > q <- atomically $ Cache.new (== '(') (==')') |
46 | -- > let go = mapM_ (atomically . (uncurry $ Cache.push q) | 46 | -- > let go = mapM_ (atomically . (uncurry $ Cache.push q) |
@@ -135,7 +135,7 @@ push u (Just n) x = do | |||
135 | Status.push scache x | 135 | Status.push scache x |
136 | 136 | ||
137 | -- | Pull off a chunk from the 'UpdateStream' for processing. | 137 | -- | Pull off a chunk from the 'UpdateStream' for processing. |
138 | -- | 138 | -- |
139 | -- If chunks are not pulled off quickly, they may be obsoleted | 139 | -- If chunks are not pulled off quickly, they may be obsoleted |
140 | -- and discarded when new messages are 'push'ed. | 140 | -- and discarded when new messages are 'push'ed. |
141 | pull :: Ord slot => UpdateStream slot x -> STM x | 141 | pull :: Ord slot => UpdateStream slot x -> STM x |