Fixed the reference counting of Semaphore internal implementation.
git-svn-id: http://yate.null.ro/svn/yate/trunk@2796 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
05ef31e6b7
commit
16c5905559
|
@ -449,8 +449,7 @@ bool SemaphorePrivate::lock(long maxwait)
|
|||
}
|
||||
if (thr)
|
||||
thr->m_locking = false;
|
||||
if (!rval)
|
||||
deref();
|
||||
deref();
|
||||
GlobalMutex::unlock();
|
||||
if (warn && !rval)
|
||||
Debug(DebugFail,"Thread '%s' could not lock semaphore '%s' for %lu usec!",
|
||||
|
@ -460,6 +459,8 @@ bool SemaphorePrivate::lock(long maxwait)
|
|||
|
||||
bool SemaphorePrivate::unlock()
|
||||
{
|
||||
GlobalMutex::lock();
|
||||
ref();
|
||||
if (!s_unsafe) {
|
||||
#ifdef _WINDOWS
|
||||
::ReleaseSemaphore(m_semaphore,1,NULL);
|
||||
|
@ -469,7 +470,6 @@ bool SemaphorePrivate::unlock()
|
|||
::sem_post(&m_semaphore);
|
||||
#endif
|
||||
}
|
||||
GlobalMutex::lock();
|
||||
deref();
|
||||
GlobalMutex::unlock();
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue