Date: Thu, 23 Sep 2010 23:48:40 -0400 From: Jung-uk Kim <jkim@FreeBSD.org> To: Daniel Eischen <deischen@freebsd.org> Cc: freebsd-threads@freebsd.org Subject: Re: threads/150889: PTHREAD_MUTEX_INITIALIZER + pthread_mutex_destroy () == EINVAL Message-ID: <201009232348.45201.jkim@FreeBSD.org> In-Reply-To: <Pine.GSO.4.64.1009231839080.18138@sea.ntplx.net> References: <201009232220.o8NMK3fX011639@freefall.freebsd.org> <Pine.GSO.4.64.1009231839080.18138@sea.ntplx.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 23 September 2010 06:44 pm, Daniel Eischen wrote: > 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. Ah, I see. I verified that libthr does it correctly. However, that's a hack and it is far from real static allocation although it should work pretty well in reality, IMHO. More over, it will have a side-effect, i.e., any destroyed mutex may be resurrected if it is used again. POSIX seems to say it should return EINVAL when it happens. :-( > You _do have_ to lock the mutex before calling a condition > wait, however. This is a POSIX requirement. Yes, understood. Thanks, Jung-uk Kim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009232348.45201.jkim>