opening a file for writing and reading
Jeremy Shaw
jeremy at n-heptane.com
Mon Jan 11 22:49:07 EST 2010
Hello,
I am trying to write a program which logs an IRC channel, and makes
the log life available via HTTP.
Currently I open the log file for writing in AppendMode, and keep it
open, writing new lines as they come.
I open the file for reading using withBinaryFile and ReadMode.
Alas, I get the error, openBinaryFile: resource busy (file is locked).
What is the proper work around for this?
I could only open the file for writing when I actually have something
to write, and then close it afterwards. But that still leaves a race
condition if I try to write the file while it is being served or read
the file while it is being updated.
The read and writing are both done in the same application, but in
different parts of the code. There is no way to share the file handle
between the two parts.
Thanks!
- jeremy
More information about the Libraries
mailing list