wxMUTEX_DEAD_LOCK, // mutex is already locked by the calling thread
wxMUTEX_BUSY, // mutex is already locked by another thread
wxMUTEX_UNLOCKED, // attempt to unlock a mutex which is not locked
+ wxMUTEX_TIMEOUT, // LockTimeout() has timed out
wxMUTEX_MISC_ERROR // any other error
};
};
// forward declarations
-class WXDLLIMPEXP_BASE wxThreadHelper;
-class WXDLLIMPEXP_BASE wxConditionInternal;
-class WXDLLIMPEXP_BASE wxMutexInternal;
-class WXDLLIMPEXP_BASE wxSemaphoreInternal;
-class WXDLLIMPEXP_BASE wxThreadInternal;
+class WXDLLIMPEXP_FWD_BASE wxThreadHelper;
+class WXDLLIMPEXP_FWD_BASE wxConditionInternal;
+class WXDLLIMPEXP_FWD_BASE wxMutexInternal;
+class WXDLLIMPEXP_FWD_BASE wxSemaphoreInternal;
+class WXDLLIMPEXP_FWD_BASE wxThreadInternal;
// ----------------------------------------------------------------------------
// A mutex object is a synchronization object whose state is set to signaled
// The caller must call Unlock() later if Lock() returned wxMUTEX_NO_ERROR.
wxMutexError Lock();
+ // Same as Lock() but return wxMUTEX_TIMEOUT if the mutex can't be locked
+ // during the given number of milliseconds
+ wxMutexError LockTimeout(unsigned long ms);
+
// Try to lock the mutex: if it is currently locked, return immediately
// with an error. Otherwise the caller must call Unlock().
wxMutexError TryLock();
wxCondError Broadcast();
+#if WXWIN_COMPATIBILITY_2_6
// deprecated version, don't use
- bool Wait(unsigned long milliseconds)
- { return WaitTimeout(milliseconds) == wxCOND_NO_ERROR; }
+ wxDEPRECATED( bool Wait(unsigned long milliseconds) );
+#endif // WXWIN_COMPATIBILITY_2_6
private:
wxConditionInternal *m_internal;
DECLARE_NO_COPY_CLASS(wxCondition)
};
+#if WXWIN_COMPATIBILITY_2_6
+ inline bool wxCondition::Wait(unsigned long milliseconds)
+ { return WaitTimeout(milliseconds) == wxCOND_NO_ERROR; }
+#endif // WXWIN_COMPATIBILITY_2_6
+
// ----------------------------------------------------------------------------
// wxSemaphore: a counter limiting the number of threads concurrently accessing
// a shared resource
#else // !wxUSE_THREADS
// no thread support
-inline void WXDLLIMPEXP_BASE wxMutexGuiEnter() { }
-inline void WXDLLIMPEXP_BASE wxMutexGuiLeave() { }
+inline void wxMutexGuiEnter() { }
+inline void wxMutexGuiLeave() { }
// macros for entering/leaving critical sections which may be used without
// having to take them inside "#if wxUSE_THREADS"