Conditionalize use of pthread_mutexattr_setpshared() as this is an optional

POSIX feature from _POSIX_THREAD_PROCESS_SHARED group. Besides, Ulrich Drepper
mentions "the kernel support for this option wasn't available until 2.5.7.
Future versions of the thread library will support this option."
<http://people.redhat.com/drepper/posix-option-groups.html>

BTW, this nukes a warning when build on FreeBSD 4.6
This commit is contained in:
gbeauche 2002-09-16 15:06:24 +00:00
parent 7c1352a5f7
commit ea98d02ce8
2 changed files with 3 additions and 0 deletions

View File

@ -135,6 +135,7 @@ fi
AC_CHECK_FUNCS(pthread_cancel)
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
AC_CHECK_FUNCS(pthread_mutexattr_settype)
AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
SEMSRC=

View File

@ -803,7 +803,9 @@ struct B2_mutex {
#if defined(HAVE_PTHREAD_MUTEXATTR_SETTYPE) && defined(PTHREAD_MUTEX_NORMAL)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
#endif
#ifdef HAVE_PTHREAD_MUTEXATTR_SETPSHARED
pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
#endif
pthread_mutex_init(&m, &attr);
pthread_mutexattr_destroy(&attr);
}