This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/58038] std::this_thread::sleep_until can cause inifinite sleep
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 31 Jul 2013 14:35:00 +0000
- Subject: [Bug libstdc++/58038] std::this_thread::sleep_until can cause inifinite sleep
- Auto-submitted: auto-generated
- References: <bug-58038-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58038
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Or we could just check unconditionally, which handles situations where the
clock is adjusted while sleeping:
/// sleep_until
template<typename _Clock, typename _Duration>
inline void
sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
{
auto __now = _Clock::now();
while (__now < __atime)
{
sleep_for(__atime - __now);
__now = _Clock::now();
}
}
I have another timing related bug to fix so will deal with this too.