lundberj at gmail dot com
2013-10-30 22:46:21 UTC
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58931
Bug ID: 58931
Summary: condition_variable::wait_until overflowed by large
time_point<steady_clock>
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lundberj at gmail dot com
With valid but large steady clock time_points, condition_variable.wait_until
does not sleep at all, but instead continues as if the time was passed.
Perhaps related to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54562
Example:
#include <chrono>
#include <mutex>
#include <condition_variable>
int main(){
std::mutex m;
std::condition_variable cv;
std::unique_lock<std::mutex> lk(m);
// does not sleep at all:
cv.wait_until(lk,
std::chrono::time_point<std::chrono::steady_clock>::max());
// sleeps fine:
//cv.wait_until(lk,
// std::chrono::steady_clock::now()+10000*std::chrono::hours{24*365});
}
cheers / Johan -thanks for a great compiler!
PS.
* I compiled gcc with --enable-libstdcxx-time=yes. Using 64 bit linux 3.5.0
* The bug does not occur with system_clock.
* I used time_point max() to let a worker thread wait when a queue of delayed
events was empty.
Bug ID: 58931
Summary: condition_variable::wait_until overflowed by large
time_point<steady_clock>
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lundberj at gmail dot com
With valid but large steady clock time_points, condition_variable.wait_until
does not sleep at all, but instead continues as if the time was passed.
Perhaps related to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54562
Example:
#include <chrono>
#include <mutex>
#include <condition_variable>
int main(){
std::mutex m;
std::condition_variable cv;
std::unique_lock<std::mutex> lk(m);
// does not sleep at all:
cv.wait_until(lk,
std::chrono::time_point<std::chrono::steady_clock>::max());
// sleeps fine:
//cv.wait_until(lk,
// std::chrono::steady_clock::now()+10000*std::chrono::hours{24*365});
}
cheers / Johan -thanks for a great compiler!
PS.
* I compiled gcc with --enable-libstdcxx-time=yes. Using 64 bit linux 3.5.0
* The bug does not occur with system_clock.
* I used time_point max() to let a worker thread wait when a queue of delayed
events was empty.