summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorsesse <sesse@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-06 10:07:39 +0000
committersesse <sesse@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-06 10:07:39 +0000
commit8e19e877610819b5be4092fd4ce9b4183b1bfd4b (patch)
treea7f37e93826c86ecb02c806d568dfafab5d0c6ec /loader
parent474c365479b863984e34c0c2e0dfe6c9d353c7fb (diff)
downloadmpv-8e19e877610819b5be4092fd4ce9b4183b1bfd4b.tar.bz2
mpv-8e19e877610819b5be4092fd4ce9b4183b1bfd4b.tar.xz
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
Diffstat (limited to 'loader')
-rw-r--r--loader/win32.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/loader/win32.c b/loader/win32.c
index a73924f59f..20c15f850c 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -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;
}