jabowery has asked for the wisdom of the Perl Monks concerning the following question:
open A,">>alldata.log" || die ("Cannot open file: $!"); flock(A, LOCK_EX); seek(A, 0, SEEK_END) || die ("Cannot seek: $!"); print A $logstring; close A
Occasionally, I find that a long $logstring from one process will be interrupted by a $logstring from the other process and, at the new-line of the interrupting $logstring, the long $logstring will resume.
I thought that flushing was handled properly automatically.
PS: This happens with or without the seek.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: flock seek flush
by Loops (Curate) on Jul 18, 2013 at 01:18 UTC | |
by jabowery (Beadle) on Jul 18, 2013 at 16:37 UTC |