+// ----------------------------------------------------------------------------
+// wxWakeUpPipeMT: thread-safe version of wxWakeUpPipe
+// ----------------------------------------------------------------------------
+
+// This class can be used from multiple threads, i.e. its WakeUp() can be
+// called concurrently.
+
+class wxWakeUpPipeMT : public wxWakeUpPipe
+{
+public:
+ wxWakeUpPipeMT() { }
+
+ // Thread-safe wrapper around WakeUpNoLock(): can be called from another
+ // thread to wake up the main one.
+ void WakeUp()
+ {
+ wxCriticalSectionLocker lock(m_pipeLock);
+
+ WakeUpNoLock();
+ }
+
+ virtual void OnReadWaiting()
+ {
+ wxCriticalSectionLocker lock(m_pipeLock);
+
+ wxWakeUpPipe::OnReadWaiting();
+ }
+
+private:
+ // Protects access to m_pipeIsEmpty.
+ wxCriticalSection m_pipeLock;
+};
+