From ad706e99e3ea7788773abf22d786f6a8a47ea071 Mon Sep 17 00:00:00 2001 From: Matthias Huetsch Date: Mon, 10 Feb 2003 19:40:27 +0000 Subject: #107292# Added 'SalXLib::Wakeup()' call to 'SalXLib::StartTimer()' to unblock 'SalXLib::Yield()' from a previous later timeout (merged from r1.2.40.1). --- vcl/unx/source/app/saltimer.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'vcl/unx') diff --git a/vcl/unx/source/app/saltimer.cxx b/vcl/unx/source/app/saltimer.cxx index 62f317e0a839..3cfc398130d8 100644 --- a/vcl/unx/source/app/saltimer.cxx +++ b/vcl/unx/source/app/saltimer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: saltimer.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: pl $ $Date: 2001-03-02 14:23:27 $ + * last change: $Author: mhu $ $Date: 2003-02-10 20:40:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,15 +99,16 @@ inline void SalXLib::StopTimer() inline void SalXLib::StartTimer( ULONG nMS ) { - gettimeofday( &Timeout_, NULL ); + timeval Timeout (Timeout_); // previous timeout. + gettimeofday (&Timeout_, 0); - nTimeoutMS_ = nMS; - Timeout_.tv_sec += nTimeoutMS_ / 1000; - Timeout_.tv_usec += nTimeoutMS_ ? (nTimeoutMS_ % 1000) * 1000 : 500; - if( Timeout_.tv_usec > 1000000 ) + nTimeoutMS_ = nMS; + Timeout_ += nTimeoutMS_; + + if ((Timeout > Timeout_) || (Timeout.tv_sec == 0)) { - Timeout_.tv_sec++; - Timeout_.tv_usec -= 1000000; + // Wakeup from previous timeout (or stopped timer). + Wakeup(); } } -- cgit