[Haskell-cafe] Opening the same file multiple times
Einar Karttunen
ekarttun at cs.helsinki.fi
Mon Dec 12 01:30:55 EST 2005
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
Try the same in ghc / ghci:
e at yui:~$ ghci
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.4.1, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base-1.0 ... linking ... done.
Prelude> :m IO
Prelude IO> af <- openFile "z" AppendMode
Prelude IO> sf <- openFile "z" ReadMode
*** Exception: z: openFile: resource busy (file is locked)
Prelude IO>
- Einar Karttunen
More information about the Haskell-Cafe
mailing list