How to safely maintain a status file

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Jul 13 06:21:40 CEST 2012


On Thu, 12 Jul 2012 23:49:02 -0400, Gene Heskett wrote:

> When I wanted to impress the visiting frogs, I often did something I
> have never been able to do on any other operating system since, start
> assembling a long assembly language file on one of the screens on the
> color monitor, hit the clear key to advance to the amber screen and
> start a listing on it of the assemblers output listing file.
> 
> Because the file locking was applied only to the sector (256 bytes on
> that machine) being written at the instant, the listing would fly by
> till it caught up with the assemblers output, running into the lock and
> then dutifully following along, one sector behind the assemblers output,
> until the assembly was finished.  That was in 1986 folks, and in the
> year of our Lord 2012, 26 years later, I still cannot do that in linux. 

Um, what you are describing sounds functionally equivalent to what 
tail -f does.


> When I ask why not, the replies seem to think I'm from outer space.  Its
> apparently a concept that is not even attempted to be understood by the
> linux code carvers.

You could certainly create a pair of cooperative programs, one which 
keeps a lock on only the last block of the file, and a tail-like reader 
which honours that lock. But why bother? Just have the assembler append 
to the file, and let people use any reader they like, such as tail.

Or have I misunderstood you?



-- 
Steven



More information about the Python-list mailing list