[Haskell-cafe] Re: Optimizing locking with MVars
John Meacham
john at repetae.net
Wed May 3 16:33:54 EDT 2006
On Wed, May 03, 2006 at 12:07:19PM +0100, Simon Marlow wrote:
> This won't affect Handle I/O unfortunately, because we need block to
> protect against asynchronous exceptions. I'm still not certain you
> won't need that in the stream library, too: check any stateful code (eg.
> buffering) and imagine what happens if an exception is raised at an
> arbitrary point.
Is unlocking the lock really the right thing to do on an asynchronous
exception? A lock isn't a resource, it is a primitive needed to enforce
correctness of your program. You use them to protect critical sections
and chances are aborting a critical section at an arbitrary point would
leave your program in an incorrect state, just delaying your deadlock or
hiding the errors silently somewhere where they can bite you later.
hmmm... ever think asynchronous exceptions are more trouble then they
are worth...
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell-Cafe
mailing list