[Haskell-cafe] Shared/Exclusive Locks
jgoerzen at complete.org
Wed Dec 28 11:05:15 EST 2005
I have the need for a locking object that can provide shared and
exclusive locks in much the same manner as the POSIX flock() function.
A thread that acquires an exclusive lock has a guarantee that no other
thread holds any locks.
A thread that acquires a shared lock has a guarantee that no other
thread holds an exclusive lock, though any number of other threads hold
My intuition tells me that this could be implemented in terms of an MVar
somehow. (At least, I've used MVars for simple locks for quite some
time.) But I can't quite figure out how. Any ideas?
More information about the Haskell-Cafe