Threaded Daemon - boost::mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed.

Hi This seems an interesting error. I have an application that when executed as ./execute runs just as fine as can be. However when run with a a daemon that loads on boot, when activated it immediately crashes with. /usr/include/boost/thread/pthread/mutex.hpp:50: void boost::mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed. The cause of the problem clearly is the lack of an in your face shell which I know and is fine. I am wondering what advice anyone might have for having a stable boost threaded tty less executable that will run. I know it is something very small to change likely in the call to execute the application but please any help is appreciated, Thank you, John D

On Sun, Jun 28, 2009 at 09:53:02PM +0300, John D wrote:
/usr/include/boost/thread/pthread/mutex.hpp:50: void boost::mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed.
Try to get the underlying mutex (pthread_mutex_t) from the mutex object, use the pthread_mutex_lock function instead of the lock() method, inspect its return value and log it somewhere.. Then you'll have a better idea on why the lock fails. Not having a shell alone is not a plausible explanation for the crash. Maybe somebody better acquainted with Boost.Thread can suggest a less round-about way of avoiding the assertion and retrieving a useful error code from the lock() method.
participants (2)
-
John D
-
Zeljko Vrba