Hello users.

I am running a single thread which locks and unlocks mutexes, and I get the following error:

             /usr/include/boost/thread/pthread/mutex.hpp:55: void boost::mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed,

after a boost::shared_mutex::lock() or a boost::shared_mutex::try_lock().

In fact, I checked the error code that pthread_mutex_lock(&m) returned and it was the EINVAL error (code number 22).

The posix manual gives 2 possibilities for this error: 1) the mutex has not been properly initialized, or 2) The mutex was created with the protocol attribute having the value PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than the mutex's current priority ceiling. Sadly, the mutex is correctly initialized. As far as possibility (2) is concerned, well I cannot interpret it...


My code is pretty big, so I cannot provide a complete snippet, but roughly (just in case it helps):

****************************************************************************************************
I have the following class:
class Vertex
{
      boost::shared_mutex mtx;

      Vertex()
      {}
};

whose objects call Vertex::mtx->lock(), Vertex::mtx->unlock(), Vertex::mtx->lock_shared(), and Vertex::mtx->unlock_shared().

The above error is produced whenever a specific object (residing in memory) locks or even try_locks its mutex. It always happens for a specific object.
****************************************************************************************************


I am using the GNU C++ compiler 4.4.3 on Ubuntu x86_64.

I do realize that the information I provide in this email is little, but I, being new in boost::mutexes and having spent so much time on it, decided to give it a shot.


Best Regards,
Panagiotis Foteinos