concurrent-extra icon indicating copy to clipboard operation
concurrent-extra copied to clipboard

Acquire lock with timeout

Open fintara opened this issue 2 years ago • 0 comments

Similarly to Broadcast's listenTimeout, it may be useful to have:

  • acquireTimeout :: Lock -> Integer -> IO Bool and
  • 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?

fintara avatar May 15 '23 10:05 fintara