interprocess icon indicating copy to clipboard operation
interprocess copied to clipboard

boost::named_mutex remains acquired after crash

Open skryv-softserveinc opened this issue 7 years ago • 5 comments

tried on macOS

skryv-softserveinc avatar May 08 '18 11:05 skryv-softserveinc

It exists on any OS. Because the default named_mutex is spin_wait, you can view the source code, there is macro to change internal implementation. You can change it to posix pthread_mutex on macOS, now it update to robust mutex, maybe you need to update the source code.

363568233 avatar Dec 17 '18 06:12 363568233

Changed the posix mutex implementation to be robust #66

363568233 avatar Dec 17 '18 06:12 363568233

#if defined(BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES) typedef ipcdetail::posix_named_mutex internal_mutex_type; #undef BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) typedef ipcdetail::windows_named_mutex internal_mutex_type; #undef BOOST_INTERPROCESS_USE_WINDOWS #else typedef ipcdetail::shm_named_mutex internal_mutex_type; #endif But define BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES, boost using the posix semaphore, deadlock are also possible. You should use posix_mutex shared in process, but named_mutex dont't use posix_mutex. I did it myself...

363568233 avatar Dec 17 '18 10:12 363568233

Would this issue ever get fixed? It has been there for almost a decade. I spent one whole day to add named_mutex and named_condition to my windows apps, and then found out this issue forcing me to look for other solutions.

seanlis avatar Oct 31 '20 13:10 seanlis

I'm also wondering why the PR #66 was closed without ever being merged. Running into this problem is quite annoying when a known solution has existed for so long!

Dalzhim avatar Nov 11 '22 19:11 Dalzhim