[Haskell-cafe] Opening the same file multiple times

Donn Cave donn at drizzle.com
Mon Dec 12 02:52:18 EST 2005


Quoth Einar Karttunen <ekarttun at cs.helsinki.fi>:
| On 11.12 22:26, Donn Cave wrote:
| > Quoth Einar Karttunen <ekarttun at cs.helsinki.fi>:
| > | It seems that opening the same file multiple times (one writer
| > | and multiple readers) is not supported at least on *nix with
| > | GHC. I want to use one Handle to use append data till the
| > | end of the file while other Handles perform random access
| > | IO with seeks on the file.
| > 
| > How is it not supported?  What happens with something like this
...
| *** Exception: z: openFile: resource busy (file is locked)

Oh.  Well, that's unfortunate, but at least I see it is documented.
I guess that explains why your solution uses unlockFile.

I suppose you might be able to use Posix.IO functions instead,
but that would probably be even more trouble than your work-around.

	Donn Cave, donn at drizzle.com


More information about the Haskell-Cafe mailing list