logoalt Hacker News

crazygringoyesterday at 5:03 PM0 repliesview on HN

It should just work.

If one thread is writing another thread tries to write, the first thread will have the file write lock, and the second thread will wait to write until that lock is released.

I've written code using the pattern you describe and it's totally fine.