+ wxThreadInternal();
+ ~wxThreadInternal();
+
+ // thread entry function
+ static void *PthreadStart(void *ptr);
+
+ // thread actions
+ // start the thread
+ wxThreadError Run();
+ // ask the thread to terminate
+ void Cancel();
+ // wake up threads waiting for our termination
+ void SignalExit();
+ // go to sleep until Resume() is called
+ void Pause();
+ // resume the thread
+ void Resume();
+
+ // accessors
+ // priority
+ int GetPriority() const { return m_prio; }
+ void SetPriority(int prio) { m_prio = prio; }
+ // state
+ thread_state GetState() const { return m_state; }
+ void SetState(thread_state state) { m_state = state; }
+ // id
+ pthread_t GetId() const { return thread_id; }
+ // "cancelled" flag
+ bool WasCancelled() const { return m_cancelled; }
+
+//private: -- should be!
+ pthread_t thread_id;
+
+private:
+ thread_state m_state; // see thread_state enum
+ int m_prio; // in wxWindows units: from 0 to 100
+
+ // set when the thread should terminate
+ bool m_cancelled;
+
+ // this (mutex, cond) pair is used to synchronize the main thread and this
+ // thread in several situations:
+ // 1. The thread function blocks until condition is signaled by Run() when
+ // it's initially created - this allows create thread in "suspended"
+ // state
+ // 2. The Delete() function blocks until the condition is signaled when the
+ // thread exits.
+ wxMutex m_mutex;
+ wxCondition m_cond;
+
+ // another (mutex, cond) pair for Pause()/Resume() usage
+ //
+ // VZ: it's possible that we might reuse the mutex and condition from above
+ // for this too, but as I'm not at all sure that it won't create subtle
+ // problems with race conditions between, say, Pause() and Delete() I
+ // prefer this may be a bit less efficient but much safer solution
+ wxMutex m_mutexSuspend;
+ wxCondition m_condSuspend;