1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-12 01:46:16 +00:00

reviewed the locking codes, a mutex should be unlocked before destroying it

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11854 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
alex 2004-01-25 20:29:31 +00:00
parent ca02bdcc20
commit edfe08ef4e

View File

@ -1379,6 +1379,8 @@ static void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c)
cs->locked=0; cs->locked=0;
pthread_mutex_unlock(&(cs->mutex)); pthread_mutex_unlock(&(cs->mutex));
} }
else
printf("Win32 Warning: Unlocking unlocked Critical Section %p!!\n", c);
return; return;
} }
@ -1394,6 +1396,18 @@ static void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c)
// struct CRITSECT* cs=(struct CRITSECT*)c; // struct CRITSECT* cs=(struct CRITSECT*)c;
dbgprintf("DeleteCriticalSection(0x%x)\n",c); dbgprintf("DeleteCriticalSection(0x%x)\n",c);
if (!cs)
{
printf("Win32 Warning: Deleting uninitialized Critical Section %p!!\n", c);
return;
}
if (cs->locked)
{
printf("Win32 Warning: Deleting unlocked Critical Section %p!!\n", c);
pthread_mutex_unlock(&(cs->mutex));
}
#ifndef GARBAGE #ifndef GARBAGE
pthread_mutex_destroy(&(cs->mutex)); pthread_mutex_destroy(&(cs->mutex));
// released by GarbageCollector in my_relase otherwise // released by GarbageCollector in my_relase otherwise