]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 584057 ] Fixes calculation bug in wxThread::Sleep
authorJulian Smart <julian@anthemion.co.uk>
Thu, 8 Aug 2002 10:04:13 +0000 (10:04 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 8 Aug 2002 10:04:13 +0000 (10:04 +0000)
There's a problem in src/mac/thread.cpp function
wxThread::Sleep when CLOCKS_PER_SEC is not
1000. The amount-to-sleep code doesn't take into
account this value. Due to this when I did Sleep(1000) it
was sleeping a fraction of a second because on my Mac
CLOCKS_PER_SEC is 60. This patch fixes it.

Dimitri Schoolwerth (dimitrishortcut)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/thread.cpp
src/mac/thread.cpp

index 5ea6f21f32161da7e3e231648f847f60dab88611..474b92a22f79fb6d36f63e07b7c57e02cecf75a1 100644 (file)
@@ -523,11 +523,11 @@ void wxThread::Yield()
 
 void wxThread::Sleep(unsigned long milliseconds)
 {
-        clock_t start = clock() ;
-        do
-        {
-            YieldToAnyThread() ;
-        } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
+    clock_t start = clock();
+    do
+    {
+        YieldToAnyThread();
+    } while( clock() - start < (milliseconds * CLOCKS_PER_SEC) / 1000 ) ;
 }
 
 int wxThread::GetCPUCount()
index 5ea6f21f32161da7e3e231648f847f60dab88611..474b92a22f79fb6d36f63e07b7c57e02cecf75a1 100644 (file)
@@ -523,11 +523,11 @@ void wxThread::Yield()
 
 void wxThread::Sleep(unsigned long milliseconds)
 {
-        clock_t start = clock() ;
-        do
-        {
-            YieldToAnyThread() ;
-        } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
+    clock_t start = clock();
+    do
+    {
+        YieldToAnyThread();
+    } while( clock() - start < (milliseconds * CLOCKS_PER_SEC) / 1000 ) ;
 }
 
 int wxThread::GetCPUCount()