On 20/05/2020 01:22, Niall Douglas wrote:
BTW, I assume you realise that your proposed scheme won't be watertight right? I mean that Windows doesn't send you a signal on process termination, and there are ways of terminating a POSIX process without it ever receiving a signal either. The biggest source of that on Linux is OOM, which is very irritating of it.
I'm not sure if Boost.Interprocess makes use of them (I assume not) but on Windows the standard kernel interprocess mutex will report an "abandoned" mutex if something tries to acquire a mutex that was owned by a terminated process/thread, regardless of how it was terminated. This is a successful acquisition that indicates that the protected state may not be consistent. Though I expect that most apps don't handle it as such and either just treat it as failure or press ahead anyway and just hope they don't crash/corrupt.