From 8ec47261e193b1f983b898a0d985b85e7fcb0668 Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Tue, 26 Jul 2016 15:18:44 +0200 Subject: Use monotonic time with condition variables. Configure condition variables to use monotonic time using pthread_condattr_setclock on systems where this is possible. This fixes the issue when thread waiting on condition variable is woken up too late when system time is moved backwards. --- src/libstd/sys/windows/condvar.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/libstd/sys/windows') diff --git a/src/libstd/sys/windows/condvar.rs b/src/libstd/sys/windows/condvar.rs index 8075374d42b..d708b327c55 100644 --- a/src/libstd/sys/windows/condvar.rs +++ b/src/libstd/sys/windows/condvar.rs @@ -24,6 +24,9 @@ impl Condvar { Condvar { inner: UnsafeCell::new(c::CONDITION_VARIABLE_INIT) } } + #[inline] + pub unsafe fn init(&mut self) {} + #[inline] pub unsafe fn wait(&self, mutex: &Mutex) { let r = c::SleepConditionVariableSRW(self.inner.get(), -- cgit 1.4.1-3-g733a5