From 35e9c131e219d5f26f1012cbe442cb9565fa25bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 24 Jun 2010 10:33:57 +0000 Subject: [PATCH] Fix thread ID formatting in log messages. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/threadpsx.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 95d8586f91..031ade47b5 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -60,11 +60,8 @@ #include // for setpriority() #endif -#ifdef __VMS - #define THR_ID(thr) ((long long)(thr)->GetId()) -#else - #define THR_ID(thr) ((long)(thr)->GetId()) -#endif +#define THR_ID_CAST(id) (reinterpret_cast(id)) +#define THR_ID(thr) THR_ID_CAST((thr)->GetId()) // ---------------------------------------------------------------------------- // constants @@ -593,14 +590,14 @@ wxSemaError wxSemaphoreInternal::Wait() { wxLogTrace(TRACE_SEMA, wxT("Thread %p waiting for semaphore to become signalled"), - wxThread::GetCurrentId()); + THR_ID_CAST(wxThread::GetCurrentId())); if ( m_cond.Wait() != wxCOND_NO_ERROR ) return wxSEMA_MISC_ERROR; wxLogTrace(TRACE_SEMA, wxT("Thread %p finished waiting for semaphore, count = %lu"), - wxThread::GetCurrentId(), (unsigned long)m_count); + THR_ID_CAST(wxThread::GetCurrentId()), (unsigned long)m_count); } m_count--; @@ -667,7 +664,7 @@ wxSemaError wxSemaphoreInternal::Post() wxLogTrace(TRACE_SEMA, wxT("Thread %p about to signal semaphore, count = %lu"), - wxThread::GetCurrentId(), (unsigned long)m_count); + THR_ID_CAST(wxThread::GetCurrentId()), (unsigned long)m_count); return m_cond.Signal() == wxCOND_NO_ERROR ? wxSEMA_NO_ERROR : wxSEMA_MISC_ERROR; @@ -733,7 +730,7 @@ public: }; wxLogTrace(TRACE_THREADS, wxT("Thread %p: %s => %s."), - GetId(), stateNames[m_state], stateNames[state]); + THR_ID(this), stateNames[m_state], stateNames[state]); #endif // wxUSE_LOG_TRACE m_state = state; @@ -1392,7 +1389,7 @@ wxThreadError wxThread::Resume() { case STATE_PAUSED: wxLogTrace(TRACE_THREADS, wxT("Thread %p suspended, resuming."), - GetId()); + THR_ID(this)); m_internal->Resume(); @@ -1400,7 +1397,7 @@ wxThreadError wxThread::Resume() case STATE_EXITED: wxLogTrace(TRACE_THREADS, wxT("Thread %p exited, won't resume."), - GetId()); + THR_ID(this)); return wxTHREAD_NO_ERROR; default: @@ -1621,8 +1618,8 @@ wxThread::~wxThread() if ( m_internal->GetState() != STATE_EXITED && m_internal->GetState() != STATE_NEW ) { - wxLogDebug(wxT("The thread %ld is being destroyed although it is still running! The application may crash."), - (long)GetId()); + wxLogDebug(wxT("The thread %p is being destroyed although it is still running! The application may crash."), + THR_ID(this)); } m_critsect.Leave(); @@ -1782,7 +1779,7 @@ static void ScheduleThreadForDeletion() static void DeleteThread(wxThread *This) { - wxLogTrace(TRACE_THREADS, wxT("Thread %p auto deletes."), This->GetId()); + wxLogTrace(TRACE_THREADS, wxT("Thread %p auto deletes."), THR_ID(This)); delete This; -- 2.45.2