Subject: Re: mplayer/pthread problem
To: Wojciech Puchar <wojtek@tensor.3miasto.net>
From: Min Sik Kim <minskim@bawi.org>
List: current-users
Date: 01/24/2004 02:10:39
--Signature=_Sat__24_Jan_2004_02_10_39_-0600_jeeOyBNR+Z=BOlyu
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

* Wojciech Puchar:
> trying to play ANY movie (any format, with sound on or off - doesn't
> matter) with mplayer from pkgsrc:
> 
> .
> .
> .
> Starting playback...
> mplayer: Error detected by libpthread: Unlocking unlocked mutex.
> Detected by file "/usr/src/lib/libpthread/pthread_mutex.c", line 340,
> function "pthread_mutex_unlock".
> See pthread(3) for information.

It happens in Windows emulation codes when a codec leaves a critical
section without even entering it.  Codes emulating Windows should not
call pthread_mutex_unlock() in such a case.  The following patch will
fix this.

------------------------------------------------------------------------
--- loader/win32.c.orig	2003-09-05 17:08:23.000000000 -0500
+++ loader/win32.c
@@ -1374,8 +1374,10 @@ static void WINAPI expLeaveCriticalSecti
 	printf("Win32 Warning: Leaving uninitialized Critical Section %p!!\n", c);
 	return;
     }
+    if (cs->locked) {
     cs->locked=0;
     pthread_mutex_unlock(&(cs->mutex));
+    }
     return;
 }
 
------------------------------------------------------------------------

I've sent this to the mplayer-dev-eng mailing list, waiting for
moderator's approval because I'm not on the list.

-- 
Min Sik Kim

--Signature=_Sat__24_Jan_2004_02_10_39_-0600_jeeOyBNR+Z=BOlyu
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iD8DBQFAEih/DE3c1cDPIHARAuBbAJ9st6hDIQS+riRVHdxIdfzDvS3eEQCfRViQ
w9lv4bvOX0XPS6U9JGeC8M8=
=2uPa
-----END PGP SIGNATURE-----

--Signature=_Sat__24_Jan_2004_02_10_39_-0600_jeeOyBNR+Z=BOlyu--