projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed incorrect param from docs
[wxWidgets.git]
/
src
/
os2
/
thread.cpp
diff --git
a/src/os2/thread.cpp
b/src/os2/thread.cpp
index 7b4a4643c8a617688d4460990a545adc63efa511..94de24c7cdc4d2353d6cf4f6b4c5a488db934f68 100644
(file)
--- a/
src/os2/thread.cpp
+++ b/
src/os2/thread.cpp
@@
-53,21
+53,21
@@
wxMutex* p_wxMainMutex;
wxThread* m_pThread; // pointer to the wxWindows thread object
// if it's FALSE, some secondary thread is holding the GUI lock
wxThread* m_pThread; // pointer to the wxWindows thread object
// if it's FALSE, some secondary thread is holding the GUI lock
-static bool s_bGuiOwnedByMainThread = TRUE;
+static bool
g
s_bGuiOwnedByMainThread = TRUE;
// critical section which controls access to all GUI functions: any secondary
// thread (i.e. except the main one) must enter this crit section before doing
// any GUI calls
// critical section which controls access to all GUI functions: any secondary
// thread (i.e. except the main one) must enter this crit section before doing
// any GUI calls
-static wxCriticalSection *s_pCritsectGui = NULL;
+static wxCriticalSection *
g
s_pCritsectGui = NULL;
// critical section which protects s_nWaitingForGui variable
// critical section which protects s_nWaitingForGui variable
-static wxCriticalSection *s_pCritsectWaitingForGui = NULL;
+static wxCriticalSection *
g
s_pCritsectWaitingForGui = NULL;
// number of threads waiting for GUI in wxMutexGuiEnter()
// number of threads waiting for GUI in wxMutexGuiEnter()
-static size_t s_nWaitingForGui = 0;
+static size_t
g
s_nWaitingForGui = 0;
// are we waiting for a thread termination?
// are we waiting for a thread termination?
-static bool s_bWaitingForThread = FALSE;
+static bool
g
s_bWaitingForThread = FALSE;
// ============================================================================
// OS/2 implementation of thread classes
// ============================================================================
// OS/2 implementation of thread classes
@@
-232,7
+232,7
@@
wxCondition::~wxCondition()
void wxCondition::Wait()
{
void wxCondition::Wait()
{
- (void)m_internal->Wait(SEM_INFINITE_WAIT);
+ (void)m_internal->Wait(SEM_IN
DE
FINITE_WAIT);
}
bool wxCondition::Wait(
}
bool wxCondition::Wait(
@@
-356,10
+356,10
@@
ULONG wxThreadInternal::OS2ThreadStart(
// enter m_critsect before changing the thread state
pThread->m_critsect.Enter();
// enter m_critsect before changing the thread state
pThread->m_critsect.Enter();
- bool bWasCancelled =
t
hread->m_internal->GetState() == STATE_CANCELED;
+ bool bWasCancelled =
pT
hread->m_internal->GetState() == STATE_CANCELED;
pThread->m_internal->SetState(STATE_EXITED);
pThread->m_internal->SetState(STATE_EXITED);
-
t
hread->m_critsect.Leave();
+
pT
hread->m_critsect.Leave();
pThread->OnExit();
pThread->OnExit();
@@
-368,7
+368,7
@@
ULONG wxThreadInternal::OS2ThreadStart(
if (pThread->IsDetached() && !bWasCancelled)
{
// auto delete
if (pThread->IsDetached() && !bWasCancelled)
{
// auto delete
- delete
t
hread;
+ delete
pT
hread;
}
//else: the joinable threads handle will be closed when Wait() is done
return dwRet;
}
//else: the joinable threads handle will be closed when Wait() is done
return dwRet;
@@
-380,6
+380,7
@@
void wxThreadInternal::SetPriority(
{
// translate wxWindows priority to the PM one
ULONG ulOS2_Priority;
{
// translate wxWindows priority to the PM one
ULONG ulOS2_Priority;
+ ULONG ulrc;
m_nPriority = nPriority;
m_nPriority = nPriority;
@@
-582,7
+583,7
@@
wxThreadError wxThread::Delete(ExitCode *pRc)
if (IsMain())
{
// set flag for wxIsWaitingForThread()
if (IsMain())
{
// set flag for wxIsWaitingForThread()
- gs_
w
aitingForThread = TRUE;
+ gs_
bW
aitingForThread = TRUE;
#if wxUSE_GUI
wxBeginBusyCursor();
#if wxUSE_GUI
wxBeginBusyCursor();
@@
-611,7
+612,7
@@
wxThreadError wxThread::Delete(ExitCode *pRc)
if ( IsMain() )
{
if ( IsMain() )
{
- gs_
w
aitingForThread = FALSE;
+ gs_
bW
aitingForThread = FALSE;
#if wxUSE_GUI
wxEndBusyCursor();
#if wxUSE_GUI
wxEndBusyCursor();
@@
-626,9
+627,6
@@
wxThreadError wxThread::Delete(ExitCode *pRc)
delete this;
}
delete this;
}
- wxASSERT_MSG( (DWORD)rc != STILL_ACTIVE,
- wxT("thread must be already terminated.") );
-
if ( pRc )
*pRc = rc;
if ( pRc )
*pRc = rc;
@@
-729,10
+727,10
@@
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
bool wxThreadModule::OnInit()
{
bool wxThreadModule::OnInit()
{
- s_pCritsectWaitingForGui = new wxCriticalSection();
+
g
s_pCritsectWaitingForGui = new wxCriticalSection();
- s_pCritsectGui = new wxCriticalSection();
- s_pCritsectGui->Enter();
+
g
s_pCritsectGui = new wxCriticalSection();
+
g
s_pCritsectGui->Enter();
PTIB ptib;
PPIB ppib;
PTIB ptib;
PPIB ppib;
@@
-745,14
+743,18
@@
bool wxThreadModule::OnInit()
void wxThreadModule::OnExit()
{
void wxThreadModule::OnExit()
{
- if (s_pCritsectGui)
+ if (
g
s_pCritsectGui)
{
{
- s_pCritsectGui->Leave();
- delete s_pCritsectGui;
- s_pCritsectGui = NULL;
+ gs_pCritsectGui->Leave();
+#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
+ delete gs_pCritsectGui;
+#endif
+ gs_pCritsectGui = NULL;
}
}
- wxDELETE(s_pCritsectWaitingForGui);
+#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
+ wxDELETE(gs_pCritsectWaitingForGui);
+#endif
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
@@
-766,24
+768,24
@@
void WXDLLEXPORT wxWakeUpMainThread()
void WXDLLEXPORT wxMutexGuiLeave()
{
void WXDLLEXPORT wxMutexGuiLeave()
{
- wxCriticalSectionLocker enter(*s_pCritsectWaitingForGui);
+ wxCriticalSectionLocker enter(*
g
s_pCritsectWaitingForGui);
if ( wxThread::IsMain() )
{
if ( wxThread::IsMain() )
{
- s_bGuiOwnedByMainThread = FALSE;
+
g
s_bGuiOwnedByMainThread = FALSE;
}
else
{
// decrement the number of waiters now
}
else
{
// decrement the number of waiters now
- wxASSERT_MSG(
s_nWaitingForGui > 0,
+ wxASSERT_MSG(
g
s_nWaitingForGui > 0,
wxT("calling wxMutexGuiLeave() without entering it first?") );
wxT("calling wxMutexGuiLeave() without entering it first?") );
- s_nWaitingForGui--;
+
g
s_nWaitingForGui--;
wxWakeUpMainThread();
}
wxWakeUpMainThread();
}
- s_pCritsectGui->Leave();
+
g
s_pCritsectGui->Leave();
}
void WXDLLEXPORT wxMutexGuiLeaveOrEnter()
}
void WXDLLEXPORT wxMutexGuiLeaveOrEnter()
@@
-791,17
+793,17
@@
void WXDLLEXPORT wxMutexGuiLeaveOrEnter()
wxASSERT_MSG( wxThread::IsMain(),
wxT("only main thread may call wxMutexGuiLeaveOrEnter()!") );
wxASSERT_MSG( wxThread::IsMain(),
wxT("only main thread may call wxMutexGuiLeaveOrEnter()!") );
- wxCriticalSectionLocker enter(*s_pCritsectWaitingForGui);
+ wxCriticalSectionLocker enter(*
g
s_pCritsectWaitingForGui);
- if (
s_nWaitingForGui == 0
)
+ if (
gs_nWaitingForGui == 0
)
{
// no threads are waiting for GUI - so we may acquire the lock without
// any danger (but only if we don't already have it)
if (!wxGuiOwnedByMainThread())
{
{
// no threads are waiting for GUI - so we may acquire the lock without
// any danger (but only if we don't already have it)
if (!wxGuiOwnedByMainThread())
{
- s_pCritsectGui->Enter();
+
g
s_pCritsectGui->Enter();
- s_bGuiOwnedByMainThread = TRUE;
+
g
s_bGuiOwnedByMainThread = TRUE;
}
//else: already have it, nothing to do
}
}
//else: already have it, nothing to do
}
@@
-818,12
+820,12
@@
void WXDLLEXPORT wxMutexGuiLeaveOrEnter()
bool WXDLLEXPORT wxGuiOwnedByMainThread()
{
bool WXDLLEXPORT wxGuiOwnedByMainThread()
{
- return s_bGuiOwnedByMainThread;
+ return
g
s_bGuiOwnedByMainThread;
}
bool WXDLLEXPORT wxIsWaitingForThread()
{
}
bool WXDLLEXPORT wxIsWaitingForThread()
{
- return s_bWaitingForThread;
+ return
g
s_bWaitingForThread;
}
#endif
}
#endif