[REBOL] Re: Concurrent access to data file
From: timewarp:sirius at: 20-Feb-2001 1:16
i solved this problem with poem access on my site by
creating new read and write functions that "lock" the
file while it's being read from or written to.
the lock is just a temporary file that is removed as
soon as the read or write is finished. the lock exists
only as long as it takes to grab the data out of the
file or write to the file ... so the lock does not
exists the whole time the script is running, just for
about a fraction of a second, if that.
read locks are time stamped so there may be multiples
of them, this is because a read lock only prevents
writing, not reading. a write lock is just a single
file that prevents other processes from writing to or
reading from the file.
the read and write functions recheck for the lock
file's existence about every 100th of a second. the
read function only checks for a write lock while the
write function checks for a read or write lock.
i'd share the functions with you, but i wrote them
in perl. should be very easy to do in rebol.
cheerfulness,
-----EAT
Andrew Martin wrote: