From 22aacc1c980b2e0e818be129ebc7ab8724ed9d6e Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 7 Jan 2020 11:54:56 +0000 Subject: [PATCH] Check if nextEvent works as advertised --- src/Haboli/Euphoria/Client.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Haboli/Euphoria/Client.hs b/src/Haboli/Euphoria/Client.hs index b280625..0305ffd 100644 --- a/src/Haboli/Euphoria/Client.hs +++ b/src/Haboli/Euphoria/Client.hs @@ -237,11 +237,12 @@ instance FromJSON Event where , 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 = do 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 stopped <- readTVar (ciStopped info) if stopped