I want to make sure that when my program exits ungracefully (CTRL-C, seg fault, etc) it releases a Boost.Interprocess named_upgradable_mutex, if it's holding it. I've created a signal handler to catch these ungraceful exits. Is there any way to tell if my process currently holds an exclusive or sharable lock on the mutex?

I've tried blindly calling mutex.unlock() and mutex.unlock_sharable() but that seems to permanently lock the mutex when the shareable lock is set.

RickW