Within LTS Haskell 8.20 (ghc-8.0.2)
Wait until a certain clock time has passed by monitoring its flag, in the STM monad. This permits to compose timeouts with locks waiting for data using orElse
- example: wait for any respoinse from a Queue if no response is given in 5 minutes, it is returned True.
flag <- getTimeoutFlag $ 5 * 60 ap <- step . atomically $ readSomewhere >>= return . Just orElse waitUntilSTM flag >> return Nothing case ap of Nothing -> do logWF "timeout" ... Just x -> do logWF $ "received" ++ show x ...
Page 1 of 1