From owner-freebsd-standards@FreeBSD.ORG Sun Jun 20 22:52:16 2010 Return-Path: Delivered-To: standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6865106566C for ; Sun, 20 Jun 2010 22:52:16 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 7F35F8FC0C for ; Sun, 20 Jun 2010 22:52:16 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 8D8F51DD6DF; Mon, 21 Jun 2010 00:52:15 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 84ACB17231; Mon, 21 Jun 2010 00:52:15 +0200 (CEST) Date: Mon, 21 Jun 2010 00:52:15 +0200 From: Jilles Tjoelker To: Garrett Cooper Message-ID: <20100620225215.GA4116@stack.nl> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: standards@freebsd.org Subject: Re: Question over POSIX compliancy of pthread_once_t X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 22:52:16 -0000 On Sun, Jun 20, 2010 at 01:52:22AM -0700, Garrett Cooper wrote: > PTHREAD_ONCE_INIT / pthread_once_t isn't tersely defined according to > pthread(3) or sys/types.h at on the opengroup pages [1, 2, 3] > FreeBSD defines it as follows: > /usr/include/pthread.h:#define PTHREAD_ONCE_INIT { PTHREAD_NEEDS_INIT, NULL } > /* ... */ > /* > * Once definitions. > */ > struct pthread_once { > int state; > pthread_mutex_t mutex; > }; > glibc-2.7 has PTHREAD_ONCE_INIT defined differently [4]: > 208 /* Single execution handling. */ > 209 #define PTHREAD_ONCE_INIT 0 > I can't determine which one is semantically correct. Both are correct in their respective implementations, as they are valid initializers for the corresponding pthread_once_t. POSIX does not require pthread_once_t to be an integer type, it may also be a struct. -- Jilles Tjoelker