
Anthony Williams wrote:
However, I would not expect the mutex to survive a reboot --- there might still be data in the file, but I would expect a process-shared mutex to have at least some portion that was a handle to a kernel object, and the kernel object would go away with a reboot.
I expect the same to be true of condition variables. There is certainly nothing in the POSIX spec that says you can save a mutex to disk and read it back again. In fact, there is explicit wording in the rationale to suggest that some implementations may just store a pointer to the actual data structure --- in which case, writing it to disk and reading it back is not going to work, as the pointer will be invalid.
Even if POSIX does not officially guarantee it, I think filesystem persistence is very useful for mutexes, like the message queue example shows. Interprocess users are pretty happy with it. Until now all systems I've found that support process-shared mutexes do support the mapped files option. I wouldn't request your help if the task was easy ;-)
Anthony
Regards, Ion