[MPlayer-cvslog] r30852 - trunk/loader/win32.c

sesse subversion at mplayerhq.hu
Sat Mar 6 11:07:39 CET 2010


Author: sesse
Date: Sat Mar  6 11:07:39 2010
New Revision: 30852

Log:
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.

Modified:
   trunk/loader/win32.c

Modified: trunk/loader/win32.c
==============================================================================
--- trunk/loader/win32.c	Sat Mar  6 11:05:10 2010	(r30851)
+++ trunk/loader/win32.c	Sat Mar  6 11:07:39 2010	(r30852)
@@ -890,7 +890,7 @@ static void* WINAPI expWaitForSingleObje
 	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 expWaitForSingleObje
 	    if (ml->semaphore==0)
 		pthread_cond_wait(ml->pc,ml->pm);
 	    ml->semaphore--;
+	    ret = WAIT_OBJECT_0;
 	}
 	break;
     }


More information about the MPlayer-cvslog mailing list