+ clock_t start = clock();
+ do
+ {
+ YieldToAnyThread();
+ } while( clock() - start < milliseconds / 1000.0 * CLOCKS_PER_SEC ) ;
+}
+
+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)
+{
+ m_internal = new wxThreadInternal();
+
+ m_isDetached = kind == wxTHREAD_DETACHED;
+ s_threads.Add( (void*) this ) ;
+}
+
+wxThread::~wxThread()
+{
+ s_threads.Remove( (void*) this ) ;
+ if (m_internal != NULL) {
+ delete m_internal;
+ m_internal = NULL;
+ }