[MPlayer-dev-eng] pthread error on NetBSD

Min Sik Kim minskim at bawi.org
Sat Jan 24 00:35:47 CET 2004


Hi,

I tried to play a movie on NetBSD with mplayer, and got the following
error.

  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.


  MPlayer interrupted by signal 6 in module: decode_video
  - MPlayer crashed. This shouldn't happen.
    It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
    gcc version. If you think it's MPlayer's fault, please read

    DOCS/HTML/en/bugreports.html and follow the instructions there. We
    can't and won't help unless you provide this information when
    reporting a possible bug.
  mplayer: Error detected by libpthread: Destroying locked mutex.
  Detected by file "/usr/src/lib/libpthread/pthread_mutex.c", line 135,
  function "pthread_mutex_destroy".
  See pthread(3) for information.

I found that codecs call expLeaveCriticalSection() in win32.c without
calling expEnterCriticalSection() first.  Thus, in
expLeaveCriticalSection(), pthread_mutex_unlock() is called with an
unlocked mutex.  On NetBSD, this causes the process to abort.
(pthread_mutex_unlock() on NetBSD-current conforms to ISO/IEC
9945-1:1996 (``POSIX.1'').)

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;
 }
 

Any better way to handle this?  If not, could you apply this patch?
I'm not on this list.  Please CC: to me any reply.


Regards,
Min
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040123/f495ec1f/attachment.pgp>


More information about the MPlayer-dev-eng mailing list