
I created a sample test harness to use the code that was causing this. It happens when the program is about to shutdown (at the destruction time). This text was printed by boost "void boost::mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed." The mutex is not used in the destructor. Below are the details of the exact frame. (gdb) fr 4 #4 0x08053631 in ~mutex (this=0x80e5998) at /inc/boost/thread/pthread/mutex.hpp:45 45 BOOST_VERIFY(!pthread_mutex_destroy(&m)); (gdb) p m $1 = {__data = {__lock = 1, __count = 0, __owner = 3470, __kind = 0, __nusers = 1, {__spins = 0, __list = {__next = 0x0}}}, __size = "\001\000\000\000\000\000\000\000\216\r\000\000\000\000\000\000\001\000\000\000\000\000\000", __align = 1} Why should it crash the system? On Fri, Oct 3, 2008 at 4:37 PM, Matthew L. Creech <mlcreech@gmail.com>wrote:
On Fri, Oct 3, 2008 at 3:50 PM, amit khandelwal <khandelwal.amit@gmail.com> wrote:
I am getting an assertion in boost::mutex while using static mutex variables. Below is the stack trace for that.
void boost::mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed.
Was the assertion failure for pthread_mutex_lock(), or pthread_mutex_destroy()? Your assertion message has the former, but the back-trace indicates the latter.
Either way, the cause might be static initialization order. Do you have a global object whose destructor makes use (directly, or indirectly through any contained classes' destructors) of a mutex which is also part of some global object?
-- Matthew L. Creech _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- ------------------------------------------------------------------- Ph : (732) 647 5679 Email: khandelwal.amit@gmail.com Web: http://khandelwal.amit.googlepages.com/home -------------------------------------------------------------------