There are other options
Maybe you can write 2 files with time stamps and merge them at the end of a run based on time.
Or have a separate process perform the logging (ie create shared memory or some other ipc like sockets). The logging process just gets data from other processes and stores in a file. Other processes could just place data they want logged in shared memory (or send via socket however its set up) without blocking or worrying about locks. This is significantly more complicated but may work better in the long run.
In reply to Re: Writing to a log file without colliding
by acomjean
in thread Writing to a log file without colliding
by cgraf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |