]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/thread.cpp
typo fixed: should be lpthread, not -lpthread in THREAD_OPTS
[wxWidgets.git] / src / os2 / thread.cpp
index f7890fa08475d3c64e56a3618de93ddb458df216..af2e0f7304c9a4911b38d0e7ad7a46a69f4b2501 100644 (file)
@@ -170,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)
@@ -208,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)
     {
@@ -239,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()
@@ -317,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();
@@ -415,6 +418,7 @@ void wxThreadInternal::SetPriority(
 
 bool wxThreadInternal::Create(
   wxThread*                         pThread
+, unsigned int                      uStackSize
 )
 {
     APIRET                          ulrc;
@@ -423,7 +427,7 @@ bool wxThreadInternal::Create(
                              ,(PFNTHREAD)wxThreadInternal::OS2ThreadStart
                              ,(ULONG)pThread
                              ,CREATE_SUSPENDED | STACK_SPARSE
-                             ,8192L
+                             ,(ULONG)uStackSize
                             );
     if(ulrc != 0)
     {
@@ -519,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;