Boost logo

Boost Users :

Subject: Re: [Boost-users] Assertion `!pthread_mutex_destroy(&m)' failed
From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2009-06-23 14:29:06


On Tue, Jun 23, 2009 at 10:14:33AM -0700, nmittal wrote:
>
> void ctrl_c_handler(int sig) {
> cout << "Received SIGTERM" << endl;
>

This line by itself is enough to cause undefined behavior. There is very
little that you can do from a signal handler; accessing global objects such
as cout is a VERY bad idea.

>
> the program works fine and responds to messages. however I get the following
> error when i press CTRL-C
>
> mysql_dealer:
> /usr/local/include/boost-1_39/boost/thread/pthread/mutex.hpp:45:
> boost::mutex::~mutex(): Assertion `!pthread_mutex_destroy(&m)' failed.
>
> any help would be much appreciated.
>
What most probably happens is that the destructor is attempting to destroy
the mutex while it is held locked by another thread. You will need to devise
a better shutdown strategy.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net