From 8cd8a7feb72a8f45d5cb4d5f51fca7e73291d2b5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 12 Apr 2008 02:28:46 +0000 Subject: [PATCH] wxThread::Sleep() is the same as wxMilliSleep() on all platforms but Mac (and maybe it should be the same thing there as well) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/thread.h | 7 +------ include/wx/thrimpl.cpp | 14 ++++++++++++++ interface/thread.h | 4 ++-- src/msw/thread.cpp | 5 ----- src/os2/thread.cpp | 7 ------- src/palmos/thread.cpp | 4 ---- src/unix/threadpsx.cpp | 5 ----- 7 files changed, 17 insertions(+), 29 deletions(-) diff --git a/include/wx/thread.h b/include/wx/thread.h index e7dcf882ac..3c3493c3be 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -22,11 +22,6 @@ #if wxUSE_THREADS -// Windows headers define it -#ifdef Yield - #undef Yield -#endif - // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -452,7 +447,7 @@ public: // Sleep during the specified period of time in milliseconds // - // NB: at least under MSW worker threads can not call ::wxSleep()! + // This is the same as wxMilliSleep(). static void Sleep(unsigned long milliseconds); // get the number of system CPUs - useful with SetConcurrency() diff --git a/include/wx/thrimpl.cpp b/include/wx/thrimpl.cpp index 63b837fec6..b9773620a9 100644 --- a/include/wx/thrimpl.cpp +++ b/include/wx/thrimpl.cpp @@ -336,3 +336,17 @@ wxSemaError wxSemaphore::Post() return m_internal->Post(); } +// ---------------------------------------------------------------------------- +// wxThread +// ---------------------------------------------------------------------------- + +#ifndef __WXMAC__ + +#include "wx/utils.h" + +void wxThread::Sleep(unsigned long milliseconds) +{ + wxMilliSleep(milliseconds); +} + +#endif // __WXMAC__ diff --git a/interface/thread.h b/interface/thread.h index c7eca68d19..5f07abb5ed 100644 --- a/interface/thread.h +++ b/interface/thread.h @@ -593,8 +593,8 @@ public: /** Pauses the thread execution for the given amount of time. - This function should be used instead of wxSleep() by all worker - threads (i.e. all except the main one). + + This is the same as wxMilliSleep(). */ static void Sleep(unsigned long milliseconds); diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 942a0379da..301144ac14 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -916,11 +916,6 @@ void wxThread::Yield() ::Sleep(0); } -void wxThread::Sleep(unsigned long milliseconds) -{ - ::Sleep(milliseconds); -} - int wxThread::GetCPUCount() { SYSTEM_INFO si; diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index 253fb2143a..f0b8e6068e 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -569,13 +569,6 @@ void wxThread::Yield() ::DosSleep(0); } -void wxThread::Sleep( - unsigned long ulMilliseconds -) -{ - ::DosSleep(ulMilliseconds); -} - int wxThread::GetCPUCount() { ULONG CPUCount; diff --git a/src/palmos/thread.cpp b/src/palmos/thread.cpp index cd2e55d310..6dbe22bb95 100644 --- a/src/palmos/thread.cpp +++ b/src/palmos/thread.cpp @@ -412,10 +412,6 @@ void wxThread::Yield() { } -void wxThread::Sleep(unsigned long milliseconds) -{ -} - int wxThread::GetCPUCount() { return 1; diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 8e7d9bba9f..29288623cd 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -1050,11 +1050,6 @@ void wxThread::Yield() #endif } -void wxThread::Sleep(unsigned long milliseconds) -{ - wxMilliSleep(milliseconds); -} - int wxThread::GetCPUCount() { #if defined(_SC_NPROCESSORS_ONLN)