]> git.pond.sub.org Git - empserver/commitdiff
(empth_sleep) [_WIN32]: Change if to while to ensure the time has
authorRon Koenderink <rkoenderink@yahoo.ca>
Sun, 30 Sep 2007 15:39:48 +0000 (15:39 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sun, 30 Sep 2007 15:39:48 +0000 (15:39 +0000)
actually been reached.  There has been examples where the time
expired early by one second probably due a resolution error.  This
caused a scheduled update to be missed.  Broken in rev. 1.56.

src/lib/empthread/ntthread.c

index bc2e9d9c6af5fbc7aaa6530d65317c8d3c5df90b..4f736949ed3f755b57c89b0d6eddb39036a7a8b0 100644 (file)
@@ -601,7 +601,7 @@ empth_sleep(time_t until)
     empth_t *pThread = TlsGetValue(dwTLSIndex);
     int iReturn = 0;
 
     empth_t *pThread = TlsGetValue(dwTLSIndex);
     int iReturn = 0;
 
-    if ((lSec = until - time(0)) > 0) {
+    while (!iReturn && ((lSec = until - time(0)) > 0)) {
        loc_BlockThisThread();
        loc_debug("going to sleep %ld sec", lSec);
 
        loc_BlockThisThread();
        loc_debug("going to sleep %ld sec", lSec);