+// wxSemaphore: a counter limiting the number of threads concurrently accessing
+// a shared resource
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxSemaphore
+{
+public:
+ // specifying a maxcount of 0 actually makes wxSemaphore behave as if there
+ // is no upper limit, if maxcount is 1 the semaphore behaves as a mutex
+ wxSemaphore( int initialcount = 0, int maxcount = 0 );
+
+ // dtor is not virtual, don't use this class polymorphically
+ ~wxSemaphore();
+
+ // return TRUE if the semaphore has been created successfully
+ bool IsOk() const;
+
+ // wait indefinitely, until the semaphore count goes beyond 0
+ // and then decrement it and return (this method might have been called
+ // Acquire())
+ wxSemaError Wait();
+
+ // same as Wait(), but does not block, returns wxSEMA_NO_ERROR if
+ // successful and wxSEMA_BUSY if the count is currently zero
+ wxSemaError TryWait();
+
+ // same as Wait(), but as a timeout limit, returns wxSEMA_NO_ERROR if the
+ // semaphore was acquired and wxSEMA_TIMEOUT if the timeout has ellapsed
+ wxSemaError WaitTimeout(unsigned long milliseconds);
+
+ // increments the semaphore count and signals one of the waiting threads
+ wxSemaError Post();
+
+private:
+ wxSemaphoreInternal *m_internal;
+
+ DECLARE_NO_COPY_CLASS(wxSemaphore)
+};
+
+// ----------------------------------------------------------------------------
+// wxThread: class encpasulating a thread of execution