#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
+ #include "wx/app.h"
+ #include "wx/module.h"
#endif //WX_PRECOMP
-#include "wx/app.h"
#include "wx/apptrait.h"
-#include "wx/module.h"
#include "wx/utils.h"
#include <stdio.h>
bool IsOk() const { return m_vMutex != NULL; }
wxMutexError Lock() { return LockTimeout(SEM_INDEFINITE_WAIT); }
- wxMutexError TryLock() { return LockTimeout(SEM_IMMEDIATE_RETURN); }
+ wxMutexError Lock(unsigned long ms) { return LockTimeout(ms); }
+ wxMutexError TryLock();
wxMutexError Unlock();
private:
}
}
+wxMutexError wxMutexInternal::TryLock()
+{
+ const wxMutexError rc = LockTimeout( SEM_IMMEDIATE_RETURN );
+
+ // we have a special return code for timeout in this case
+ return rc == wxMUTEX_TIMEOUT ? wxMUTEX_BUSY : rc;
+}
+
wxMutexError wxMutexInternal::LockTimeout(ULONG ulMilliseconds)
{
APIRET ulrc;
switch (ulrc)
{
case ERROR_TIMEOUT:
+ return wxMUTEX_TIMEOUT;
case ERROR_TOO_MANY_SEM_REQUESTS:
return wxMUTEX_BUSY;
::DosSleep(0);
}
-void wxThread::Sleep(
- unsigned long ulMilliseconds
-)
-{
- ::DosSleep(ulMilliseconds);
-}
-
int wxThread::GetCPUCount()
{
ULONG CPUCount;
#endif
}
-void WXDLLEXPORT wxMutexGuiEnter()
+void wxMutexGuiEnterImpl()
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
gs_pCritsectGui->Enter();
}
-void WXDLLEXPORT wxMutexGuiLeave()
+void wxMutexGuiLeaveImpl()
{
wxCriticalSectionLocker enter(*gs_pCritsectWaitingForGui);