Check if nextEvent works as advertised
This commit is contained in:
parent
b7892bd139
commit
22aacc1c98
1 changed files with 3 additions and 2 deletions
|
|
@ -237,11 +237,12 @@ instance FromJSON Event where
|
||||||
, EventSnapshot <$> parseJSON v
|
, EventSnapshot <$> parseJSON v
|
||||||
]
|
]
|
||||||
|
|
||||||
--TODO: Check if this would block infinitely if the client is stopped while this
|
|
||||||
-- waits for an event
|
|
||||||
nextEvent :: Client e Event
|
nextEvent :: Client e Event
|
||||||
nextEvent = do
|
nextEvent = do
|
||||||
info <- getClientInfo
|
info <- getClientInfo
|
||||||
|
-- This appears to stop correctly when 'ciStopped' is set to True, even if
|
||||||
|
-- that happens from a different thread while this thread is waiting for the
|
||||||
|
-- event channel.
|
||||||
exceptionOrEvent <- liftIO $ atomically $ do
|
exceptionOrEvent <- liftIO $ atomically $ do
|
||||||
stopped <- readTVar (ciStopped info)
|
stopped <- readTVar (ciStopped info)
|
||||||
if stopped
|
if stopped
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue