Split wxWakeUpPipe class in MT-unsafe and MT-safe parts.

This class can also be useful when it's used in the main thread only, so
leave the lock-less part of the code in wxWakeUpPipe and derive a separate
wxWakeUpPipeMT from it for the use in wxConsoleEventLoop where it can be used
by multiple threads.

See #10258.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-07-03 00:27:53 +00:00
parent 2ccfebab09
commit bd7cea0ea6
4 changed files with 45 additions and 14 deletions

View File

@@ -69,10 +69,8 @@ wxWakeUpPipe::wxWakeUpPipe()
// wakeup handling
// ----------------------------------------------------------------------------
void wxWakeUpPipe::WakeUp()
void wxWakeUpPipe::WakeUpNoLock()
{
wxCriticalSectionLocker lock(m_pipeLock);
// No need to do anything if the pipe already contains something.
if ( !m_pipeIsEmpty )
return;
@@ -95,8 +93,6 @@ void wxWakeUpPipe::OnReadWaiting()
// got wakeup from child thread, remove the data that provoked it from the
// pipe
wxCriticalSectionLocker lock(m_pipeLock);
char buf[4];
for ( ;; )
{