mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 08:09:34 -05:00
Fix rwlock pthread draft4 compatibility.
Fix pthread_attr_init/destroy pthread draft4 compatibility.
This commit is contained in:
parent
a48b606a2f
commit
8cb0ff3a68
5 changed files with 312 additions and 222 deletions
18
configure.in
18
configure.in
|
|
@ -436,11 +436,11 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
|
||||||
|
|
||||||
dnl Check functions for compatibility
|
dnl Check functions for compatibility
|
||||||
AC_CHECK_FUNCS(pthread_kill)
|
AC_CHECK_FUNCS(pthread_kill)
|
||||||
dnl AC_CHECK_FUNCS( \
|
AC_CHECK_FUNCS( \
|
||||||
dnl pthread_attr_create pthread_attr_init \
|
pthread_attr_create pthread_attr_init \
|
||||||
dnl pthread_attr_destroy pthread_attr_delete \
|
pthread_attr_destroy pthread_attr_delete \
|
||||||
dnl pthread_attr_setdetachstate pthread_attr_setdetach_np \
|
pthread_attr_setdetachstate pthread_attr_setdetach_np \
|
||||||
dnl )
|
)
|
||||||
|
|
||||||
dnl Check for setconcurreny functions
|
dnl Check for setconcurreny functions
|
||||||
AC_CHECK_FUNCS( \
|
AC_CHECK_FUNCS( \
|
||||||
|
|
@ -483,9 +483,11 @@ int argc; char **argv;
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_SETCONCURRENCY
|
#ifdef HAVE_PTHREAD_SETCONCURRENCY
|
||||||
(void) pthread_setconcurrency(2);
|
(void) pthread_setconcurrency(2);
|
||||||
#elif HAVE_THR_SETCONCURRENCY
|
#else
|
||||||
|
#ifdef HAVE_THR_SETCONCURRENCY
|
||||||
/* Set Solaris LWP concurrency to 2 */
|
/* Set Solaris LWP concurrency to 2 */
|
||||||
thr_setconcurrency(2);
|
thr_setconcurrency(2);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pthread_create(&t, NULL, (void *) task, NULL);
|
pthread_create(&t, NULL, (void *) task, NULL);
|
||||||
|
|
@ -493,7 +495,7 @@ int argc; char **argv;
|
||||||
#if HAVE_SCHED_YIELD
|
#if HAVE_SCHED_YIELD
|
||||||
sched_yield(); /* make sure task runs first */
|
sched_yield(); /* make sure task runs first */
|
||||||
#else
|
#else
|
||||||
#if defined(HAVE_PTHREAD_YIELD)
|
#ifdef HAVE_PTHREAD_YIELD
|
||||||
pthread_yield(); /* make sure task runs first */
|
pthread_yield(); /* make sure task runs first */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -627,7 +629,7 @@ if test $ol_with_threads = manual ; then
|
||||||
AC_CHECK_HEADERS(thread.h synch.h)
|
AC_CHECK_HEADERS(thread.h synch.h)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $ol_with_threads = yes ; then
|
if test $ol_with_threads != no ; then
|
||||||
dnl needed to get reentrant/threadsafe versions
|
dnl needed to get reentrant/threadsafe versions
|
||||||
dnl
|
dnl
|
||||||
dnl hopefully this will not cause problems with
|
dnl hopefully this will not cause problems with
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,23 @@
|
||||||
|
|
||||||
LDAP_BEGIN_DECL
|
LDAP_BEGIN_DECL
|
||||||
|
|
||||||
#if defined( HAVE_DCE )
|
#if !defined( HAVE_FUNC_PTHREAD_ATTR_INIT ) && \
|
||||||
|
defined( HAVE_FUNC_PTHREAD_ATTR_CREATE )
|
||||||
#define pthread_attr_init( a ) pthread_attr_create( a )
|
#define pthread_attr_init( a ) pthread_attr_create( a )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( HAVE_FUNC_PTHREAD_ATTR_DESTROY ) && \
|
||||||
|
defined( HAVE_FUNC_PTHREAD_ATTR_DELETE )
|
||||||
#define pthread_attr_destroy( a ) pthread_attr_delete( a )
|
#define pthread_attr_destroy( a ) pthread_attr_delete( a )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( HAVE_FUNC_PTHREAD_ATTR_SETDETACHSTATE ) && \
|
||||||
|
defined( HAVE_FUNC_PTHREAD_ATTR_SETDETACHSTATE_NP )
|
||||||
#define pthread_attr_setdetachstate( a, b ) \
|
#define pthread_attr_setdetachstate( a, b ) \
|
||||||
pthread_attr_setdetach_np( a, b )
|
pthread_attr_setdetach_np( a, b )
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif !defined(HAVE_PTHREADS_D4)
|
#ifndef HAVE_PTHREADS_D4
|
||||||
#define pthread_mutexattr_default NULL
|
#define pthread_mutexattr_default NULL
|
||||||
#define pthread_condattr_default NULL
|
#define pthread_condattr_default NULL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,24 @@ is provided ``as is'' without express or implied warranty.
|
||||||
/* Define if you have the mktime function. */
|
/* Define if you have the mktime function. */
|
||||||
#undef HAVE_MKTIME
|
#undef HAVE_MKTIME
|
||||||
|
|
||||||
|
/* Define if you have the pthread_attr_create function. */
|
||||||
|
#undef HAVE_PTHREAD_ATTR_CREATE
|
||||||
|
|
||||||
|
/* Define if you have the pthread_attr_delete function. */
|
||||||
|
#undef HAVE_PTHREAD_ATTR_DELETE
|
||||||
|
|
||||||
|
/* Define if you have the pthread_attr_destroy function. */
|
||||||
|
#undef HAVE_PTHREAD_ATTR_DESTROY
|
||||||
|
|
||||||
|
/* Define if you have the pthread_attr_init function. */
|
||||||
|
#undef HAVE_PTHREAD_ATTR_INIT
|
||||||
|
|
||||||
|
/* Define if you have the pthread_attr_setdetach_np function. */
|
||||||
|
#undef HAVE_PTHREAD_ATTR_SETDETACH_NP
|
||||||
|
|
||||||
|
/* Define if you have the pthread_attr_setdetachstate function. */
|
||||||
|
#undef HAVE_PTHREAD_ATTR_SETDETACHSTATE
|
||||||
|
|
||||||
/* Define if you have the pthread_kill function. */
|
/* Define if you have the pthread_kill function. */
|
||||||
#undef HAVE_PTHREAD_KILL
|
#undef HAVE_PTHREAD_KILL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
* Library of functions implementing reader/writer locks
|
* Library of functions implementing reader/writer locks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DISABLE_BRIDGE
|
|
||||||
#include <portable.h>
|
#include <portable.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -29,8 +28,8 @@ int pthread_rdwr_init_np(pthread_rdwr_t *rdwrp, pthread_rdwrattr_t *attrp)
|
||||||
{
|
{
|
||||||
rdwrp->readers_reading = 0;
|
rdwrp->readers_reading = 0;
|
||||||
rdwrp->writer_writing = 0;
|
rdwrp->writer_writing = 0;
|
||||||
pthread_mutex_init(&(rdwrp->mutex), NULL);
|
pthread_mutex_init(&(rdwrp->mutex), pthread_mutexattr_default);
|
||||||
pthread_cond_init(&(rdwrp->lock_free), NULL);
|
pthread_cond_init(&(rdwrp->lock_free), pthread_condattr_default);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue