> After a bit of cleanup (thank you for choosing apr_file_seek, it made > the append + xthread solution simple)... this patch should 'work'. > > But the patch has the side effect of being incompatible with other > applications attempting to append to the file [such as piped output > or whatnot.] > > And it has a flaw if we are logging errors from the parent, the old > race condition still remains. It gets much worse if we factor in > the possibility of two child worker processes accessing the file > at once. Thread locks are strictly intraprocess. > > Grump.
The LockFile calls will protect against cross process updates to the file (when in APR_APPEND mode). The thread locks are to work around what appears to be a bug in the Windows LockFile implementation. LockFile can deadlock with WriteFile and I expect it is only an issue when multiple threads in a single process are accessing LockFile. Bill