test for wxHAVE_PTHREAD_CLEANUP with #ifdefs instead of testing for (never defined) HAVE_THREAD_CLEANUP_FUNCTIONS with #if

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-08-04 01:06:36 +00:00
parent 9894cc01c9
commit 816a7358d3

View File

@@ -591,10 +591,10 @@ wxSemaError wxSemaphoreInternal::Post()
extern "C" extern "C"
{ {
#if HAVE_THREAD_CLEANUP_FUNCTIONS #ifdef wxHAVE_PTHREAD_CLEANUP
// thread exit function // thread exit function
void wxPthreadCleanup(void *ptr); void wxPthreadCleanup(void *ptr);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // wxHAVE_PTHREAD_CLEANUP
void *wxPthreadStart(void *ptr); void *wxPthreadStart(void *ptr);
@@ -671,10 +671,10 @@ public:
m_isDetached = TRUE; m_isDetached = TRUE;
} }
#if HAVE_THREAD_CLEANUP_FUNCTIONS #ifdef wxHAVE_PTHREAD_CLEANUP
// this is used by wxPthreadCleanup() only // this is used by wxPthreadCleanup() only
static void Cleanup(wxThread *thread); static void Cleanup(wxThread *thread);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // wxHAVE_PTHREAD_CLEANUP
private: private:
pthread_t m_threadId; // id of the thread pthread_t m_threadId; // id of the thread
@@ -735,11 +735,11 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
// block! // block!
bool dontRunAtAll; bool dontRunAtAll;
#if HAVE_THREAD_CLEANUP_FUNCTIONS #ifdef wxHAVE_PTHREAD_CLEANUP
// install the cleanup handler which will be called if the thread is // install the cleanup handler which will be called if the thread is
// cancelled // cancelled
pthread_cleanup_push(wxPthreadCleanup, thread); pthread_cleanup_push(wxPthreadCleanup, thread);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // wxHAVE_PTHREAD_CLEANUP
// wait for the semaphore to be posted from Run() // wait for the semaphore to be posted from Run()
pthread->m_semRun.Wait(); pthread->m_semRun.Wait();
@@ -779,10 +779,10 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
// NB: at least under Linux, pthread_cleanup_push/pop are macros and pop // NB: at least under Linux, pthread_cleanup_push/pop are macros and pop
// contains the matching '}' for the '{' in push, so they must be used // contains the matching '}' for the '{' in push, so they must be used
// in the same block! // in the same block!
#if HAVE_THREAD_CLEANUP_FUNCTIONS #ifdef wxHAVE_PTHREAD_CLEANUP
// remove the cleanup handler without executing it // remove the cleanup handler without executing it
pthread_cleanup_pop(FALSE); pthread_cleanup_pop(FALSE);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // wxHAVE_PTHREAD_CLEANUP
if ( dontRunAtAll ) if ( dontRunAtAll )
{ {
@@ -802,7 +802,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
} }
} }
#if HAVE_THREAD_CLEANUP_FUNCTIONS #ifdef wxHAVE_PTHREAD_CLEANUP
// this handler is called when the thread is cancelled // this handler is called when the thread is cancelled
extern "C" void wxPthreadCleanup(void *ptr) extern "C" void wxPthreadCleanup(void *ptr)
@@ -825,7 +825,7 @@ void wxThreadInternal::Cleanup(wxThread *thread)
thread->Exit(EXITCODE_CANCELLED); thread->Exit(EXITCODE_CANCELLED);
} }
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // wxHAVE_PTHREAD_CLEANUP
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxThreadInternal // wxThreadInternal
@@ -1435,14 +1435,14 @@ wxThreadError wxThread::Kill()
{ {
// if we use cleanup function, this will be done from // if we use cleanup function, this will be done from
// wxPthreadCleanup() // wxPthreadCleanup()
#if !HAVE_THREAD_CLEANUP_FUNCTIONS #ifndef wxHAVE_PTHREAD_CLEANUP
ScheduleThreadForDeletion(); ScheduleThreadForDeletion();
// don't call OnExit() here, it can only be called in the // don't call OnExit() here, it can only be called in the
// threads context and we're in the context of another thread // threads context and we're in the context of another thread
DeleteThread(this); DeleteThread(this);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // wxHAVE_PTHREAD_CLEANUP
} }
else else
{ {