|
Posted by mouse on 11/30/06 20:31
In article <waDbh.1716$s04.10@fe78.usenetserver.com>, dta@e3ft.com
says...
> "David T. Ashley" <dta@e3ft.com> wrote in message
> news:giCbh.3572$xf7.2887@fe81.usenetserver.com...
> > The solution you proposed above probably has race conditions.
> > Specifically, if a log entry is made (by another process) at the points
> > I've marked with an asterisk above, you will lose some lines from the log
> > file.
>
> Also, if you're seeing this problem for the first time, this might help:
>
> http://en.wikipedia.org/wiki/Race_condition
>
> The operating system will assign CPU time to processes in unpredictable
> patterns, so if one process stops running and the other goes at the points
> I've marked with an asterisk ...
>
> The "mv" solution is robust because Unix was designed that way ... the
> solution you proposed probably has a race conditions that may cause log file
> lines to be lost.
>
>
>
>
pseudocode
start
If filesize > 2Mb rename log.txt log.bak
end;
Navigation:
[Reply to this message]
|