It only works properly if the std::mutex is used in addition to the file_lock. That was originally my thought when I read "It's unspecified if a file_lock synchronizes two
threads from the same process.", but it seemed like I was following the guidance "Use the same thread to lock and unlock
a file.". If I haven't messed anything up, I would probably update the documentation to say something like:
"If utilitizing the file_lock from multiple threads within the same process, synchronize access to the file_lock with an intraprocess synchronization mechanism such as a mutex."