I use boost::interpocess::scoped_lock, using named_mutexand a timeout; I work in Linux OS.
During one of my tests, I had a crash: since then, every time I try to start the application again, it gets stuck at the point where I created the lock; it seems that the mutex has remained acquired in some way (without the possibility of using it).
Also, if you look at the code below, I expect that after 150 microseconds, timed scoped_lockwill come back to give me an error .. but it’s not ... it just hangs there.
namespace bi = boost::interprocess;
bi::named_mutex m_mutex;
try{
boost::posix_time::ptime pt(
boost::posix_time::microsec_clock::local_time() ) ;
pt+= boost::posix_time::microseconds( 150 );
bi::scoped_lock< bi::named_mutex > lock( m_mutex, pt );
if( !lock.owns() ){
FATAL( "I didn't acquire the lock." );
return EXIT_FAILURE;
}
....
My questions are as follows:
- How to make sure
boost::interprocessmutex is destroyed? (so how to see the general mutex through processes and how to destroy them). - 150 ? - ?
AFG