in reply to Re^4: [threads] Open a file in one thread and allow others to write to it
in thread [threads] Open a file in one thread and allow others to write to it
you are assuming that OS will sync the File->writes without any race conditions problems,
Um. No. That's why I used a shared variable to coordinate
my $sem :shared; open LOG, '>', 'log.txt' or die $!; sub logit { lock $sem; return printf LOG @_; }
Perhaps you could just try running the code I posted where you are, and tell me what problems you see?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: [threads] Open a file in one thread and allow others to write to it
by gulden (Monk) on Nov 16, 2009 at 13:37 UTC | |
by BrowserUk (Patriarch) on Nov 16, 2009 at 13:56 UTC | |
|