Subject: [Boost-bugs] [Boost C++ Libraries] #6377: Condition variable blocks when changing time
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-01-11 09:55:33
#6377: Condition variable blocks when changing time
-------------------------------------------------+--------------------------
Reporter: Johan Borkhuis <johan@â¦> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.47.0 | Severity: Problem
Keywords: condition variable |
-------------------------------------------------+--------------------------
I am using Linux on an ARM system, running Boost 1.47. My application
needs accurate timing, and for this I use a POSIX timer using SIGRTMIN.
This part is not something that I can control, it is an external library
that implements this. I use condition variables as a timing mechanism
within my software.
When I use condition variables without the POSIX timer there is no
problem. The timing continues correctly, even if I change the time forward
or backward.
When I start the POSIX timer the condition variable does not time-out when
I change the time backward. It only times out when the original time (plus
timeout) is reached.
When I changed the clock of the pthread condition variable to monotonic
(call to pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC)) the result
was OK
again.
Attached is a test application that shows the problem and implements a
solution. This solution is not within the Boost library but directly as a
POSIX condition variable.
Options to the test application:
{{{
-b: use boost condition variable
-s: generate POSIX signals
}}}
When running the testapplication with -bs the application will stop
reporting when the time is changed backwards. When the time is set back to
a time after the time the time was changed the application will continue.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6377> 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:08 UTC