Proposal: Stop enforcing single-writer-multi-reader file access

Duncan Coutts duncan.coutts at
Tue Nov 8 13:04:57 CET 2011

On Tue, 2011-11-08 at 11:54 +0000, Duncan Coutts wrote:
> On Wed, 2011-10-26 at 23:59 +0100, Ian Lynagh wrote:
> > Hi all,
> > 
> > Haskell currently requires that multiple-reader single-writer locking is
> > used on files. I understand the motivation for this was to try to
> > protect people from running into problems due to lazy IO, but in
> > practice I think it just causes more problems than it solves.

> > I propose that we remove all the automatic locking from the libraries,
> > and let the user do any locking that they wish to do themselves.

> I have to say, I'm a little reticent about this.
> Certainly it's useful to be able deliberately to have multiple writers,
> or to be able deliberately to read a file while also writing to it. But
> doing so accidentally seems like a bug waiting to happen doesn't it?

BTW, I realise this proposal has received a good deal of support,
however I suspect this is from people who are thinking about the current
inability to opt-out from locking in the various cases where it would be
useful for them to do so.

Perhaps the people who have spoken up in favour of this proposal could
comment on the following:

        We all seem to agree that its important to be able to open a
        file without any locking.

        There is a distinction between being able to opt-out from
        locking and removing all locking by default.
              * do you think it important to remove all locking?
              * would you be satisfied (or put up with) having to
                explicitly opt-out of locking when opening a file?
              * do you see any value at all in locking by default to
                catch bugs where files are read and written concurrently
                by accident?


More information about the Libraries mailing list