added accessor function to hide __VISAGECPP__ ugliness and avoid having #ifdef's for it every other line

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-03-01 01:21:04 +00:00
parent 9e91f49d7d
commit cd30330fc6
2 changed files with 12 additions and 30 deletions

View File

@ -2417,8 +2417,14 @@ protected:
#if wxUSE_THREADS
#if defined (__VISAGECPP__)
const wxCriticalSection& Lock() const { return m_eventsLocker; }
wxCriticalSection& Lock() { return m_eventsLocker; }
wxCriticalSection m_eventsLocker;
# else
const wxCriticalSection& Lock() const { return *m_eventsLocker; }
wxCriticalSection& Lock() { return *m_eventsLocker; }
wxCriticalSection* m_eventsLocker;
# endif
#endif

View File

@ -1089,22 +1089,14 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
wxCHECK_RET( eventCopy,
_T("events of this type aren't supposed to be posted") );
#if defined(__VISAGECPP__)
wxENTER_CRIT_SECT( m_eventsLocker);
#else
wxENTER_CRIT_SECT( *m_eventsLocker);
#endif
wxENTER_CRIT_SECT( Lock() );
if ( !m_pendingEvents )
m_pendingEvents = new wxList;
m_pendingEvents->Append(eventCopy);
#if defined(__VISAGECPP__)
wxLEAVE_CRIT_SECT( m_eventsLocker);
#else
wxLEAVE_CRIT_SECT( *m_eventsLocker);
#endif
wxLEAVE_CRIT_SECT( Lock() );
// 2) Add this event handler to list of event handlers that
// have pending events.
@ -1129,11 +1121,7 @@ void wxEvtHandler::ProcessPendingEvents()
wxCHECK_RET( m_pendingEvents,
wxT("Please call wxApp::ProcessPendingEvents() instead") );
#if defined(__VISAGECPP__)
wxENTER_CRIT_SECT( m_eventsLocker);
#else
wxENTER_CRIT_SECT( *m_eventsLocker);
#endif
wxENTER_CRIT_SECT( Lock() );
// remember last event to process during this iteration
wxList::compatibility_iterator lastPendingNode = m_pendingEvents->GetLast();
@ -1146,18 +1134,10 @@ void wxEvtHandler::ProcessPendingEvents()
// In ProcessEvent, new events might get added and
// we can safely leave the crtical section here.
#if defined(__VISAGECPP__)
wxLEAVE_CRIT_SECT( m_eventsLocker);
#else
wxLEAVE_CRIT_SECT( *m_eventsLocker);
#endif
wxLEAVE_CRIT_SECT( Lock() );
ProcessEvent(*event);
delete event;
#if defined(__VISAGECPP__)
wxENTER_CRIT_SECT( m_eventsLocker);
#else
wxENTER_CRIT_SECT( *m_eventsLocker);
#endif
wxENTER_CRIT_SECT( Lock() );
// leave the loop once we have processed all events that were present
// at the start of ProcessPendingEvents because otherwise we could get
@ -1169,11 +1149,7 @@ void wxEvtHandler::ProcessPendingEvents()
node = m_pendingEvents->GetFirst();
}
#if defined(__VISAGECPP__)
wxLEAVE_CRIT_SECT( m_eventsLocker);
#else
wxLEAVE_CRIT_SECT( *m_eventsLocker);
#endif
wxLEAVE_CRIT_SECT( Lock() );
}
/*