#include #include int main(void) { using namespace boost::interprocess; named_mutex mutex(open_or_create, "mutX"); // This mutex is non-recursive // the mutex should be unlocked initially mutex.unlock(); // This should have no effect, as it already is unlocked mutex.unlock(); // This should have no effect, as it already is unlocked mutex.lock(); // Now the mutex should be locked mutex.lock(); // This should never return, as the mutex is already locked! return EXIT_FAILURE; // In case we arrived here, something went wrong }