in reply to Re: Update in-place with temporary file and flocking
in thread Update in-place with temporary file and flocking

Agreed. That'll probably be the solution I have to use. I was hoping however, to be able to get away with locking only the file I intended to update as this seemed neater. Clearly it's not as portable as I'd have thought though. A separate semaphore file would avoid rename failing because the destination file is locked on windows. (Neither the temporary, nor the real file would be locked at all). Just seems a shame that the above code isn't going to work reliably.
  • Comment on Re: Re: Update in-place with temporary file and flocking