X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/43543d985b04d065178df50dbbc998786ff97282..19e30148e18cc99296b26503c155e5cef59045f4:/src/os2/thread.cpp diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index ac5b0d56ca..af2e0f7304 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -21,6 +21,9 @@ #include #include "wx/module.h" +#include "wx/intl.h" +#include "wx/utils.h" +#include "wx/log.h" #include "wx/thread.h" #define INCL_DOSSEMAPHORES @@ -167,7 +170,7 @@ wxMutexError wxMutex::Unlock() class wxConditionInternal { public: - inline wxConditionInternal () + inline wxConditionInternal (wxMutex& rMutex) : m_vMutex(rMutex) { ::DosCreateEventSem(NULL, &m_vEvent, DC_SEM_SHARED, FALSE); if (!m_vEvent) @@ -205,14 +208,15 @@ public: HEV m_vEvent; int m_nWaiters; + wxMutex& m_vMutex; }; -wxCondition::wxCondition() +wxCondition::wxCondition(wxMutex& rMutex) { APIRET ulrc; ULONG ulCount; - m_internal = new wxConditionInternal; + m_internal = new wxConditionInternal(rMutex); ulrc = ::DosCreateEventSem(NULL, &m_internal->m_vEvent, 0L, FALSE); if (ulrc != 0) { @@ -236,10 +240,10 @@ void wxCondition::Wait() } bool wxCondition::Wait( - unsigned long lSec -, unsigned long lNsec) + unsigned long lMilliSec +) { - return m_internal->Wait(lSec*1000 + lNsec/1000000); + return m_internal->Wait(lMilliSec); } void wxCondition::Signal() @@ -314,7 +318,9 @@ public: } // create a new (suspended) thread (for the given thread object) - bool Create(wxThread* pThread); + bool Create( wxThread* pThread + ,unsigned int uStackSize + ); // suspend/resume/terminate bool Suspend(); @@ -412,6 +418,7 @@ void wxThreadInternal::SetPriority( bool wxThreadInternal::Create( wxThread* pThread +, unsigned int uStackSize ) { APIRET ulrc; @@ -420,7 +427,7 @@ bool wxThreadInternal::Create( ,(PFNTHREAD)wxThreadInternal::OS2ThreadStart ,(ULONG)pThread ,CREATE_SUSPENDED | STACK_SPARSE - ,8192L + ,(ULONG)uStackSize ); if(ulrc != 0) { @@ -516,9 +523,11 @@ wxThread::~wxThread() // create/start thread // ------------------- -wxThreadError wxThread::Create() +wxThreadError wxThread::Create( + unsigned int uStackSize +) { - if ( !m_internal->Create(this) ) + if ( !m_internal->Create(this, uStackSize) ) return wxTHREAD_NO_RESOURCE; return wxTHREAD_NO_ERROR; @@ -746,11 +755,15 @@ void wxThreadModule::OnExit() if (gs_pCritsectGui) { gs_pCritsectGui->Leave(); +#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) delete gs_pCritsectGui; +#endif gs_pCritsectGui = NULL; } +#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) wxDELETE(gs_pCritsectWaitingForGui); +#endif } // ----------------------------------------------------------------------------