in reply to Avoiding a race condition
You can also open the file in read/write mode. Read from the file then truncate the file to nothing and close it.
open (FILE,"+</path/file"); flock (FILE,2); # Do something with the data seek (FILE,0,0); truncate (FILE,tell (FILE)); close FILE; #file unlocks when closed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Avoiding a race condition
by ZZamboni (Curate) on May 19, 2000 at 05:37 UTC | |
by takshaka (Friar) on May 19, 2000 at 06:10 UTC | |
by ZZamboni (Curate) on May 19, 2000 at 08:18 UTC |