$NetBSD: patch-al,v 1.1 2002/12/01 18:32:37 jdolecek Exp $

--- src/ptlib/unix/tlibthrd.cxx.orig	Sun Dec  1 14:18:03 2002
+++ src/ptlib/unix/tlibthrd.cxx	Sun Dec  1 14:18:10 2002
@@ -818,18 +818,20 @@
 void PThread::Sleep(const PTimeInterval & timeout)
 {
   PTime lastTime;
-  PTime targetTime = lastTime + timeout;
-  do {
+  PTime targetTime = PTime() + timeout;
+
+  sched_yield();
+  lastTime = PTime();
+
+  while (lastTime < targetTime) {
     P_timeval tval = targetTime - lastTime;
     if (select(0, NULL, NULL, NULL, tval) < 0 && errno != EINTR)
       break;
 
-#ifndef P_NETBSD
     pthread_testcancel();
-#endif /* P_NETBSD */
 
     lastTime = PTime();
-  } while (lastTime < targetTime);
+  }
 }
 
 
