X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e64313babfa84d2806313c611503e517390b3731..0919e93e5299eb10571120cfb98a3cf8a487dc69:/src/mac/carbon/thread.cpp diff --git a/src/mac/carbon/thread.cpp b/src/mac/carbon/thread.cpp index 3634a69dde..47638b3416 100644 --- a/src/mac/carbon/thread.cpp +++ b/src/mac/carbon/thread.cpp @@ -38,6 +38,7 @@ #include #include "wx/mac/uma.h" #include "wx/mac/macnotfy.h" +#include "Timer.h" #endif #define INFINITE 0xFFFFFFFF @@ -528,11 +529,20 @@ void wxThread::Yield() void wxThread::Sleep(unsigned long milliseconds) { - clock_t start = clock(); + UnsignedWide start, now; + + Microseconds(&start); + + double mssleep = milliseconds * 1000 ; + double msstart, msnow ; + msstart = (start.hi * 4294967296.0 + start.lo) ; + do { YieldToAnyThread(); - } while( clock() - start < milliseconds * CLOCKS_PER_SEC / 1000.0 ) ; + Microseconds(&now); + msnow = (now.hi * 4294967296.0 + now.lo) ; + } while( msnow - msstart < mssleep ); } int wxThread::GetCPUCount()