+ clock_t start = clock();
+ do
+ {
+ YieldToAnyThread();
+ } while( clock() - start < milliseconds * CLOCKS_PER_SEC / 1000.0 ) ;
+}
+
+int wxThread::GetCPUCount()
+{
+ // we will use whatever MP API will be used for the new MP Macs
+ return 1;
+}
+
+unsigned long wxThread::GetCurrentId()
+{
+ ThreadID current ;
+ MacGetCurrentThread( ¤t ) ;
+ return (unsigned long)current;
+}
+
+bool wxThread::SetConcurrency(size_t level)
+{
+ wxASSERT_MSG( IsMain(), _T("should only be called from the main thread") );
+
+ // ok only for the default one
+ if ( level == 0 )
+ return 0;
+
+ // how many CPUs have we got?
+ if ( GetCPUCount() == 1 )
+ {
+ // don't bother with all this complicated stuff - on a single
+ // processor system it doesn't make much sense anyhow
+ return level == 1;
+ }
+
+ return TRUE ;
+}
+
+// ctor and dtor
+// -------------
+
+wxThread::wxThread(wxThreadKind kind)
+{
+ g_numberOfThreads++;
+ m_internal = new wxThreadInternal();
+
+ m_isDetached = kind == wxTHREAD_DETACHED;
+ s_threads.Add( (void*) this ) ;
+}
+
+wxThread::~wxThread()
+{
+ if (g_numberOfThreads>0)
+ {
+ g_numberOfThreads--;
+ }
+#ifdef __WXDEBUG__
+ else
+ {
+ wxFAIL_MSG(wxT("More threads deleted than created."));
+ }
+#endif
+
+ s_threads.Remove( (void*) this ) ;
+ if (m_internal != NULL) {
+ delete m_internal;
+ m_internal = NULL;
+ }