mirror of https://github.com/mpv-player/mpv
Fix semaphore behavior in WaitForSingleObject.
Two simple bugfixes for semaphores in WaitForSingleObject: First, semaphore count should be decreased on loading the semaphore, not increased. The case for duration=0 had this wrong (duration=-1 was fine). Second, the code for duration=-1 forgot to set the return value, so it would always return WAIT_FAILED. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30852 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
474c365479
commit
8e19e87761
|
@ -890,7 +890,7 @@ static void* WINAPI expWaitForSingleObject(void* object, int duration)
|
|||
if (duration == 0) {
|
||||
if(ml->semaphore==0) ret = WAIT_FAILED;
|
||||
else {
|
||||
ml->semaphore++;
|
||||
ml->semaphore--;
|
||||
ret = WAIT_OBJECT_0;
|
||||
}
|
||||
}
|
||||
|
@ -898,6 +898,7 @@ static void* WINAPI expWaitForSingleObject(void* object, int duration)
|
|||
if (ml->semaphore==0)
|
||||
pthread_cond_wait(ml->pc,ml->pm);
|
||||
ml->semaphore--;
|
||||
ret = WAIT_OBJECT_0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue