|
Boost Users : |
Subject: [Boost-users] [thread] assertion error in timed_lock
From: Ernst Murnleitner (mur_at_[hidden])
Date: 2009-01-11 08:00:34
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
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