Subject: [Boost-bugs] [Boost C++ Libraries] #6058: semaphore_timed_wait() behaviour inconsistent with glibc sem_timedwait()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-25 14:37:45
#6058: semaphore_timed_wait() behaviour inconsistent with glibc sem_timedwait()
--------------------------------------------+-------------------------------
Reporter: Frank <frank.kusters@â¦> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost Development Trunk | Severity: Problem
Keywords: |
--------------------------------------------+-------------------------------
What should
boost::interprocess::interprocess_semaphore::timed_wait(abs_time) return
when the absolute time it is given, is in the past, but the semaphore is
available?
The boost documentation in interprocess_semaphore.hpp is not very clear,
but it does suggest that it should return true.
The implementation in semaphore_wrapper.hpp does the following:
If BOOST_INTERPROCESS_POSIX_TIMEOUTS is defined, sem_timedwait() is called
from semaphore.h. If the macro is not defined, it will use its own
implementation, which first looks at the time, and will thus return false
in this case. This is in contradiction with the documentation.
sem_timedwait in semaphore.c, however, will first try to acquire the lock,
and if it could not get a lock, look at the time. Thus the end result will
be true, which is inconsistent with the boost version.
Please note that the POSIX documentation is unclear on this topic too, so
the semaphore.c implementation might vary from system to system. I am
talking about the GNU version.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6058> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC