threads/150889: PTHREAD_MUTEX_INITIALIZER + pthread_mutex_destroy() == EINVAL

Daniel Eischen deischen at freebsd.org
Thu Sep 23 22:58:42 UTC 2010


On Thu, 23 Sep 2010, Jung-uk Kim wrote:

> The following reply was made to PR threads/150889; it has been noted by GNATS.
>
> From: Jung-uk Kim <jkim at FreeBSD.org>
> To: bug-followup at FreeBSD.org,
> cgf at netapp.com
> Cc:
> Subject: Re: threads/150889: PTHREAD_MUTEX_INITIALIZER + pthread_mutex_destroy() == EINVAL
> Date: Thu, 23 Sep 2010 18:12:02 -0400
>
> I was horribly bitten by the incompatibility when I ported IcedTea6
> Java plugin for Linux.  Please see my comments in the patch:
>
> http://www.freebsd.org/cgi/cvsweb.cgi/ports/java/openjdk6/files/icedtea.patch?rev=1.2;content-type=text%2Fplain

You shouldn't have to call pthread_mutex_init() on a mutex
initialized with PTHREAD_MUTEX_INITIALIZER.  Our implementation
should auto initialize the mutex when it is first used; if it
doesn't, I think that is a bug.

You _do have_ to lock the mutex before calling a condition
wait, however.  This is a POSIX requirement.

-- 
DE


More information about the freebsd-threads mailing list