[thread] assertion error in timed_lock

Hello, Sometimes - especially if I start the program with valgrind - my program exits with /usr/include/boost/thread/pthread/recursive_mutex.hpp:180: bool boost::recursive_timed_mutex::timed_lock(const boost::system_time&): Assertion `!res || res==16' failed. The line 180 is in this function: bool timed_lock(system_time const & abs_time) { struct timespec const timeout=detail::get_timespec(abs_time); int const res=pthread_mutex_timedlock(&m,&timeout); BOOST_ASSERT(!res || res==EBUSY); return !res; } pthread_mutex_timedlock returned ETIMEDOUT. Can the BOOST_ASSERT be changed that it only logs a warning? In a production environment it is not nice, if the program exits. In the man page of pthread_mutex_timedlock I read: ----- ... The pthread_mutex_timedlock() function shall fail if: EINVAL 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' current priority ceiling. EINVAL The process or thread would have blocked, and the abs_timeout parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. ETIMEDOUT The mutex could not be locked before the specified timeout expired. ... ------ Isn't ETIMEDOUT a return value which has to be expected? Greetings, Ernst

"Ernst Murnleitner"
Sometimes - especially if I start the program with valgrind - my program exits with
/usr/include/boost/thread/pthread/recursive_mutex.hpp:180: bool boost::recursive_timed_mutex::timed_lock(const boost::system_time&): Assertion `!res || res==16' failed.
The line 180 is in this function:
bool timed_lock(system_time const & abs_time) { struct timespec const timeout=detail::get_timespec(abs_time); int const res=pthread_mutex_timedlock(&m,&timeout); BOOST_ASSERT(!res || res==EBUSY); return !res; }
pthread_mutex_timedlock returned ETIMEDOUT.
This bug has already been fixed. Anthony -- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL
participants (2)
-
Anthony Williams
-
Ernst Murnleitner