I've done some reading about boost::interprocess::file_lock
and it seems to do pretty much what I'm after (support shareable and exclusive locking, and being unlocked if the process crashes or exits).
One thing I'm not sure about though, is what does it do to the file? Can I use for example a file of 0 bytes long? Does boost::interprocess
write anything into it? Or is its presence all the system cares about?
I've been using boost::interprocess
now for some time to reliably memory map a file and write into it, now I need to go multiprocess and ensure that reads and writes to this file are protected; file_lock
does seem the way to go, I just wonder if I now need to add another file to use as a mutex.
Thanks in advance