From owner-freebsd-gnome@FreeBSD.ORG Wed Sep 8 22:57:14 2004 Return-Path: Delivered-To: freebsd-gnome@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B426A16A4CE; Wed, 8 Sep 2004 22:57:14 +0000 (GMT) Received: from green.homeunix.org (pcp04368961pcs.nrockv01.md.comcast.net [69.140.212.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A2D243D41; Wed, 8 Sep 2004 22:57:14 +0000 (GMT) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.13.1/8.13.1) with ESMTP id i88MvDn1079735; Wed, 8 Sep 2004 18:57:13 -0400 (EDT) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.13.1/8.13.1/Submit) id i88Mv9c3079734; Wed, 8 Sep 2004 18:57:09 -0400 (EDT) (envelope-from green) Date: Wed, 8 Sep 2004 18:57:09 -0400 From: Brian Fundakowski Feldman To: Pascal Hofstee Message-ID: <20040908225709.GI928@green.homeunix.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i cc: gnome@freebsd.org cc: freebsd-hackers@freebsd.org Subject: Re: pthread_mutex_trylock and glib-2 X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2004 22:57:14 -0000 On Tue, Sep 07, 2004 at 06:27:14PM -0700, Pascal Hofstee wrote: > On Mon, 6 Sep 2004 15:12:08 -0700, Pascal Hofstee wrote: > > After a few hours of digging through both the glib-2 as well as the > > beep-media-player sources i finally managed to figure out why > > beep-media-player apprently crashes on startup when using libpthread, > > but not when using libc_r. > > > > i filed a bugreport against this problem on bugzilla.gnome.org ... in > > the hope to get some feedback from glib-developers ... > > > > http://bugzilla.gnome.org/show_bug.cgi?id=152009 > > > > The problem is with the actual return value of pthread_mutex_trylock > > returning EDEADLK instead of EBUSY. > > > > from what i have been able to glance from this previous discussion > > regarding this particular subject > > (http://lists.freebsd.org/pipermail/freebsd-threads/2004-January/001539.html) > > > > pthread_mutex_trylock should behave identical to pthread_mutex_lock > > except return immediately in case of a blocking mutex, which would > > suggest EDEADLK as a possible return value. > > > > This Seems to be the current implementation of both libpthread as well > > as libthr ... with libc_r being the sole exception. > > > > The pthread_mutex_trylock manpage however does not reflect this actual > > implementation and only mentions EBUSY and EINVAL. > > > > I was wondering assuming the implementation is actually correct if > > this could be rectified in the pthread_mutex_trylock manpage ... and > > if my assumption is wrong if the implementation could be changed to > > reflect the manpage. > > > > In the former case i will have to bug the glib-devs to change the > > implementation of their pthread_mutex_trylock wrapper ... to also > > check for EDEADLK. > > I am hereby including an updated > /usr/ports/devel/glib20/files/patch-gthread_gthread-posix.c > > that includes the additional check for EDEADLK besides EBUSY in glib's > g_mutex_trylock_posix_impl function. > > With this fix applied to my installation of glib beep-media-player now > works as expected with libpthread, and this is very likely to resolve > similar behaviour with other ports that try to use glib's threading > functions. > > I CC-ed glib20 port-maintainer (gnome@FreeBSD.org) in the hope this > (or appropriate alternative) fix makes it in time for 5.3-RELEASE. FWIW, I had to fix a similar problem in mozilla/NSPR's codebase to make the build with debugging code turned on work. Well, I guess it was really the same problem. -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\