#include <stdio.h>
#include "wx/module.h"
+#include "wx/intl.h"
+#include "wx/utils.h"
+#include "wx/log.h"
#include "wx/thread.h"
#define INCL_DOSSEMAPHORES
class wxConditionInternal
{
public:
- inline wxConditionInternal ()
+ inline wxConditionInternal (wxMutex& rMutex) : m_vMutex(rMutex)
{
::DosCreateEventSem(NULL, &m_vEvent, DC_SEM_SHARED, FALSE);
if (!m_vEvent)
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)
{
}
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()
}
// 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();
bool wxThreadInternal::Create(
wxThread* pThread
+, unsigned int uStackSize
)
{
APIRET ulrc;
,(PFNTHREAD)wxThreadInternal::OS2ThreadStart
,(ULONG)pThread
,CREATE_SUSPENDED | STACK_SPARSE
- ,8192L
+ ,(ULONG)uStackSize
);
if(ulrc != 0)
{
// 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;