Is a sync/flush needed before writes to a locked file from multiple threads/processes in fopen a+ mode?
问题 I'm performing I/O to a single file from multiple threads. Access to this shared file foo is controlled through an advisory file lock ( flock(2) with LOCK_EX ). foo was opened with fopen(3) mode a+ . a+ was chosen because of the documentation stating: Subsequent writes to the file will always end up at the then current end of file, irrespective of any intervening fseek(3) or similar. Simplified, the operations would start: FILE *fp = fopen("foo", "a+"); ...spawn threads... Writing would