cleaned up VMS #ifdef mess

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23701 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-09-19 00:29:31 +00:00
parent 63fa42b3be
commit ef4f69ec32

View File

@@ -59,6 +59,12 @@
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#ifdef __VMS
#define THR_ID(thr) ((long long)(thr)->GetId())
#else
#define THR_ID(thr) ((long)(thr)->GetId())
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -712,11 +718,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
{ {
wxThreadInternal *pthread = thread->m_internal; wxThreadInternal *pthread = thread->m_internal;
#ifdef __VMS wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), THR_ID(pthread));
wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), (long long)pthread->GetId());
#else
wxLogTrace(TRACE_THREADS, _T("Thread %ld started."), (long)pthread->GetId());
#endif
// associate the thread pointer with the newly created thread so that // associate the thread pointer with the newly created thread so that
// wxThread::This() will work // wxThread::This() will work
@@ -753,21 +755,15 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
if ( !dontRunAtAll ) if ( !dontRunAtAll )
{ {
// call the main entry // call the main entry
wxLogTrace(TRACE_THREADS, _T("Thread %ld about to enter its Entry()."), wxLogTrace(TRACE_THREADS,
#ifdef __VMS _T("Thread %ld about to enter its Entry()."),
(long long)pthread->GetId()); THR_ID(pthread));
#else
(long)pthread->GetId());
#endif
pthread->m_exitcode = thread->Entry(); pthread->m_exitcode = thread->Entry();
wxLogTrace(TRACE_THREADS, _T("Thread %ld Entry() returned %lu."), wxLogTrace(TRACE_THREADS,
#ifdef __VMS _T("Thread %ld Entry() returned %lu."),
(long long)pthread->GetId(), (unsigned long)pthread->m_exitcode); THR_ID(pthread), (unsigned long)pthread->m_exitcode);
#else
(long)pthread->GetId(), (unsigned long)pthread->m_exitcode);
#endif
{ {
wxCriticalSectionLocker lock(thread->m_critsect); wxCriticalSectionLocker lock(thread->m_critsect);
@@ -877,11 +873,8 @@ void wxThreadInternal::Wait()
wxMutexGuiLeave(); wxMutexGuiLeave();
wxLogTrace(TRACE_THREADS, wxLogTrace(TRACE_THREADS,
#ifdef __VMS _T("Starting to wait for thread %ld to exit."),
_T("Starting to wait for thread %ld to exit."), (long long)GetId()); THR_ID(this));
#else
_T("Starting to wait for thread %ld to exit."), (long)GetId());
#endif
// to avoid memory leaks we should call pthread_join(), but it must only be // to avoid memory leaks we should call pthread_join(), but it must only be
// done once so use a critical section to serialize the code below // done once so use a critical section to serialize the code below
@@ -920,11 +913,8 @@ void wxThreadInternal::Pause()
wxCHECK_RET( m_state == STATE_PAUSED, wxCHECK_RET( m_state == STATE_PAUSED,
wxT("thread must first be paused with wxThread::Pause().") ); wxT("thread must first be paused with wxThread::Pause().") );
#ifdef __VMS wxLogTrace(TRACE_THREADS,
wxLogTrace(TRACE_THREADS, _T("Thread %ld goes to sleep."), (long long)GetId()); _T("Thread %ld goes to sleep."), THR_ID(this));
#else
wxLogTrace(TRACE_THREADS, _T("Thread %ld goes to sleep."), (long)GetId());
#endif
// wait until the semaphore is Post()ed from Resume() // wait until the semaphore is Post()ed from Resume()
m_semSuspend.Wait(); m_semSuspend.Wait();
@@ -939,11 +929,8 @@ void wxThreadInternal::Resume()
// TestDestroy() since the last call to Pause() for example // TestDestroy() since the last call to Pause() for example
if ( IsReallyPaused() ) if ( IsReallyPaused() )
{ {
#ifdef __VMS wxLogTrace(TRACE_THREADS,
wxLogTrace(TRACE_THREADS, _T("Waking up thread %ld"), (long long)GetId()); _T("Waking up thread %ld"), THR_ID(this));
#else
wxLogTrace(TRACE_THREADS, _T("Waking up thread %ld"), (long)GetId());
#endif
// wake up Pause() // wake up Pause()
m_semSuspend.Post(); m_semSuspend.Post();
@@ -953,12 +940,8 @@ void wxThreadInternal::Resume()
} }
else else
{ {
wxLogTrace(TRACE_THREADS, _T("Thread %ld is not yet really paused"), wxLogTrace(TRACE_THREADS,
#ifdef __VMS _T("Thread %ld is not yet really paused"), THR_ID(this));
(long long)GetId());
#else
(long)GetId());
#endif
} }
SetState(STATE_RUNNING); SetState(STATE_RUNNING);
@@ -1031,19 +1014,24 @@ int wxThread::GetCPUCount()
return -1; return -1;
} }
#ifdef __VMS
// VMS is a 64 bit system and threads have 64 bit pointers. // VMS is a 64 bit system and threads have 64 bit pointers.
// ??? also needed for other systems???? // FIXME: also needed for other systems????
#ifdef __VMS
unsigned long long wxThread::GetCurrentId() unsigned long long wxThread::GetCurrentId()
{ {
return (unsigned long long)pthread_self(); return (unsigned long long)pthread_self();
#else }
#else // !__VMS
unsigned long wxThread::GetCurrentId() unsigned long wxThread::GetCurrentId()
{ {
return (unsigned long)pthread_self(); return (unsigned long)pthread_self();
#endif
} }
#endif // __VMS/!__VMS
bool wxThread::SetConcurrency(size_t level) bool wxThread::SetConcurrency(size_t level)
{ {
#ifdef HAVE_THR_SETCONCURRENCY #ifdef HAVE_THR_SETCONCURRENCY