- }
-}
-
-// ----------------------------------------------------------------------------
-// wxMutex
-// ----------------------------------------------------------------------------
-
-// TODO: this is completely generic, move it to common code?
-
-wxMutex::wxMutex()
-{
- m_internal = new wxMutexInternal;
-
- m_locked = 0;
-}
-
-wxMutex::~wxMutex()
-{
- if ( m_locked > 0 )
- wxLogDebug(wxT("Freeing a locked mutex (%d locks)"), m_locked);
-
- delete m_internal;
-}
-
-wxMutexError wxMutex::Lock()
-{
- wxMutexError err = m_internal->Lock();
-
- if ( !err )
- {
- m_locked++;
- }
-
- return err;
-}
-
-wxMutexError wxMutex::TryLock()
-{
- if ( m_locked )
- {
-#ifdef NO_RECURSIVE_MUTEXES
- return wxMUTEX_DEAD_LOCK;
-#else // have recursive mutexes on this platform
- // we will succeed in locking it when we have it already locked
- return wxMUTEX_NO_ERROR;
-#endif // recursive/non-recursive mutexes
- }
-
- wxMutexError err = m_internal->TryLock();
- if ( !err )
- {
- m_locked++;
- }