[Haskell-cafe] ANN: concurrent-extra-0.1
Roel van Dijk
vandijk.roel at gmail.com
Wed Feb 17 11:11:45 EST 2010
On Wed, Feb 17, 2010 at 3:27 PM, Felipe Lessa <felipe.lessa at gmail.com> wrote:
> In acquire (l. 111), if the lock was already acquired it goes by
>
> | otherwise → do putMVar mv mb
> Lock.acquire lock
>
> So it puts back the information about the owner of the RLock and
> waits for its release in the normal Lock. And then... nothing?
> Shouldn't it need to put into mv information about itself?
Well spotted! In order to fix this we changed the structure of an
RLock a bit. The inner lock isn't contained in a Maybe anymore
but directly in the MVar. So now there is only 1 Lock associated
with an RLock. This makes reasoning about the control flow a bit
simpler.
We also added a test case which fails on the original code but
succeeds with the new version.
> In release (l. 142) Nothing is put into mv
>
> then do Lock.release lock
> putMVar mv Nothing
I'm not sure if that was a bug in the original. In the new
version we put the lock back inside the MVar.
Current version: http://hackage.haskell.org/package/concurrent-extra-0.1.0.1
Thanks,
Roel
More information about the Haskell-Cafe
mailing list