[thread] wrong assertion following call to pthread_mutex_timedlock()?

In boost 1.35 and 1.36 the implementation of mutex::timed_lock() and recursive_mutex::timed_lock() for posix-platforms with BOOST_PTHREAD_HAS_TIMEDLOCK defined looks like this: 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; } The assertion following pthread_mutex_timedlock() always fails in case of a timeout since the system call returns ETIMEDOUT when timed out and not EBUSY (according to the open group specification http://www.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_timedl...) Best regards, Wolfgang

Wolfgang Fertsak <wolfgang.fertsak@allianz.at> writes:
In boost 1.35 and 1.36 the implementation of mutex::timed_lock() and recursive_mutex::timed_lock() for posix-platforms with BOOST_PTHREAD_HAS_TIMEDLOCK defined looks like this:
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; } The assertion following pthread_mutex_timedlock() always fails in case of a timeout since the system call returns ETIMEDOUT when timed out and not EBUSY (according to the open group specification http://www.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_timedl...)
You're not the only person who's spotted this. I'll open a trac ticket, and fix it when I'm next using my linux box. 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
-
Wolfgang Fertsak