Created
July 3, 2012 07:06
-
-
Save danieldk/3038189 to your computer and use it in GitHub Desktop.
ØMQ receive with timeout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| receiveWithTimeout :: ZMQ.Socket a -> [ZMQ.Flag] -> ZMQ.Timeout -> | |
| IO (Maybe B.ByteString) | |
| receiveWithTimeout socket flags timeout = do | |
| [ZMQ.S _ reqState] <- ZMQ.poll [ZMQ.S socket ZMQ.In] timeout | |
| case reqState of | |
| ZMQ.In -> Just <$> ZMQ.receive socket flags | |
| _ -> return Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment