in reply to Atomic operation
So my advice: Just do your operation between a LOCK_EX and a LOCK_UN.
Linux and most other unixes work with flock, but you should avoid nfs-mounted partitions. It is probably best to include a test in your code if you anticipate the program to use different OSes
UPDATE: the seek in your example code seeks to the end of the file. Not a good idea if you want to read it or rewrite it, only good for appending.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Atomic operation
by ikegami (Patriarch) on Jul 20, 2009 at 17:56 UTC | |
by tilly (Archbishop) on Jul 20, 2009 at 18:29 UTC | |
by ikegami (Patriarch) on Jul 20, 2009 at 18:43 UTC |