concurrent-extra
concurrent-extra copied to clipboard
Acquire lock with timeout
Similarly to Broadcast's listenTimeout, it may be useful to have:
-
acquireTimeout :: Lock -> Integer -> IO Booland -
withTimeout :: Lock -> Integer -> IO a -> IO (Maybe a)
that try to acquire the lock in the provided time or fail (returning False and Nothing correspondingly).
Is there a technical/logical limitation for this not to work?
Is using timeout with acquire really undesirable?