in reply to
Safe to open+close for every write, without locking?
BTW, the reason I'm investigating open+write+close instead of using flock is because I might have to reopen a new file at any time anyway due to automatic rotation, plus using flock will make performance suffer when there are lots of concurrent writers. For example, with open+write+close a single process performance is 40k lines/sec and for 100 concurrent processes the overall performance is 154k lines/sec. Using flock, single process performance is 68k lines/sec but with 100 concurrent processes overall performance drops to 23k lines/sec.