Date: Sun, 20 Jun 2010 01:52:22 -0700 From: Garrett Cooper <yanefbsd@gmail.com> To: standards@freebsd.org Subject: Question over POSIX compliancy of pthread_once_t Message-ID: <AANLkTinaZRQuNdKOpp-Ma50kHjbO45cOGq7ah521f9eS@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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. Thanks, -Garrett 1. http://www.opengroup.org/onlinepubs/000095399/basedefs/pthread.h.html 2. http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html 3. http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/types.h.html 4. http://fxr.watson.org/fxr/source/nptl/sysdeps/pthread/pthread.h?v=GLIBC27#L209 PS I found a workaround for this issue at compile-time and run-time in the test, but I found this to be an odd delta.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinaZRQuNdKOpp-Ma50kHjbO45cOGq7ah521f9eS>