diff options
author | joe <joe@jerkface.net> | 2014-02-22 01:02:57 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2014-02-22 01:02:57 -0500 |
commit | 3fbeace3e43d07d726f8f8ecd7c0557ea847e3de (patch) | |
tree | a2052c9d11f8562f749c3e21d7904faf6b429e06 /Presence/LockedChan.hs | |
parent | 926f736e2c445348afa0ae02e8199d5866713434 (diff) |
Switch to LockedChan, easier to debug.
Diffstat (limited to 'Presence/LockedChan.hs')
-rw-r--r-- | Presence/LockedChan.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Presence/LockedChan.hs b/Presence/LockedChan.hs index e7e951bb..a562bc58 100644 --- a/Presence/LockedChan.hs +++ b/Presence/LockedChan.hs | |||
@@ -27,8 +27,13 @@ unlockChan c = do | |||
27 | writeLChan :: LockedChan a -> a -> STM () | 27 | writeLChan :: LockedChan a -> a -> STM () |
28 | writeLChan c a = writeTChan (chan c) a | 28 | writeLChan c a = writeTChan (chan c) a |
29 | 29 | ||
30 | -- This one blocks rather than throwing an exception... | ||
31 | -- todo: probably this should be changed to conform to the rest | ||
32 | -- of the api. | ||
30 | peekLChan :: LockedChan a -> STM a | 33 | peekLChan :: LockedChan a -> STM a |
31 | peekLChan c = peekTChan (chan c) | 34 | peekLChan c = do |
35 | readTVar (lock c) >>= check | ||
36 | peekTChan (chan c) | ||
32 | 37 | ||
33 | newLockedChan :: STM (LockedChan a) | 38 | newLockedChan :: STM (LockedChan a) |
34 | newLockedChan = do | 39 | newLockedChan = do |