mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
ITS#8772 Remove cthread support
This commit is contained in:
parent
33876e22d6
commit
5c0b820c4a
66
configure.in
66
configure.in
@ -1648,71 +1648,6 @@ int main(argc, argv)
|
||||
;;
|
||||
esac
|
||||
|
||||
case $ol_with_threads in auto | yes | mach)
|
||||
|
||||
dnl check for Mach CThreads
|
||||
AC_CHECK_HEADERS(mach/cthreads.h cthreads.h)
|
||||
if test $ac_cv_header_mach_cthreads_h = yes ; then
|
||||
ol_with_threads=found
|
||||
|
||||
dnl check for cthreads support in current $LIBS
|
||||
AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
|
||||
|
||||
if test $ol_link_threads = no ; then
|
||||
dnl try -all_load
|
||||
dnl this test needs work
|
||||
AC_CACHE_CHECK([for cthread_fork with -all_load],
|
||||
[ol_cv_cthread_all_load], [
|
||||
dnl save the flags
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="-all_load $LIBS"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mach/cthreads.h>]], [[
|
||||
cthread_fork((void *)0, (void *)0);
|
||||
]])],[ol_cv_cthread_all_load=yes],[ol_cv_cthread_all_load=no])
|
||||
dnl restore the LIBS
|
||||
LIBS="$save_LIBS"
|
||||
])
|
||||
|
||||
if test $ol_cv_cthread_all_load = yes ; then
|
||||
LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
|
||||
ol_link_threads=mach
|
||||
ol_with_threads=found
|
||||
fi
|
||||
fi
|
||||
|
||||
elif test $ac_cv_header_cthreads_h = yes ; then
|
||||
dnl Hurd variant of Mach Cthreads
|
||||
dnl uses <cthreads.h> and -lthreads
|
||||
|
||||
ol_with_threads=found
|
||||
|
||||
dnl save the flags
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lthreads"
|
||||
AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
if test $ol_link_threads = yes ; then
|
||||
LTHREAD_LIBS="-lthreads"
|
||||
ol_link_threads=mach
|
||||
ol_with_threads=found
|
||||
else
|
||||
AC_MSG_ERROR([could not link with Mach CThreads])
|
||||
fi
|
||||
|
||||
elif test $ol_with_threads = mach ; then
|
||||
AC_MSG_ERROR([could not locate Mach CThreads])
|
||||
fi
|
||||
|
||||
if test $ol_link_threads = mach ; then
|
||||
AC_DEFINE(HAVE_MACH_CTHREADS,1,
|
||||
[define if you have Mach Cthreads])
|
||||
elif test $ol_with_threads = found ; then
|
||||
AC_MSG_ERROR([could not link with Mach CThreads])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case $ol_with_threads in auto | yes | pth)
|
||||
|
||||
AC_CHECK_HEADERS(pth.h)
|
||||
@ -1777,7 +1712,6 @@ if test $ol_with_threads = manual ; then
|
||||
AC_CHECK_FUNCS(sched_yield pthread_yield)
|
||||
OL_HEADER_LINUX_THREADS
|
||||
|
||||
AC_CHECK_HEADERS(mach/cthreads.h)
|
||||
AC_CHECK_HEADERS(thread.h synch.h)
|
||||
fi
|
||||
|
||||
|
@ -24,7 +24,6 @@ Feature|Software|Version
|
||||
|{{PRD:MIT Kerberos}}|Version
|
||||
Threads:
|
||||
|POSIX {{pthreads}}|Version
|
||||
|Mach {{CThreads}}|Version
|
||||
TCP Wrappers|Name|Version
|
||||
!endblock
|
||||
|
||||
|
@ -858,7 +858,6 @@ datadir
|
||||
slapadd
|
||||
reqFilter
|
||||
matcheddomain
|
||||
CThreads
|
||||
slapacl
|
||||
requestName
|
||||
randkey
|
||||
|
@ -140,7 +140,7 @@ more information.
|
||||
H3: Threads
|
||||
|
||||
OpenLDAP is designed to take advantage of threads. OpenLDAP
|
||||
supports POSIX {{pthreads}}, Mach {{CThreads}}, and a number of
|
||||
supports POSIX {{pthreads}}, NT threads and a number of
|
||||
other varieties. {{EX:configure}} will complain if it cannot
|
||||
find a suitable thread subsystem. If this occurs, please
|
||||
consult the {{F:Software|Installation|Platform Hints}} section
|
||||
|
@ -81,34 +81,6 @@ typedef pthread_rwlock_t ldap_int_thread_rdwr_t;
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#elif defined ( HAVE_MACH_CTHREADS )
|
||||
/**********************************
|
||||
* *
|
||||
* definitions for Mach CThreads *
|
||||
* *
|
||||
**********************************/
|
||||
|
||||
#if defined( HAVE_MACH_CTHREADS_H )
|
||||
# include <mach/cthreads.h>
|
||||
#elif defined( HAVE_CTHREADS_H )
|
||||
# include <cthreads.h>
|
||||
#endif
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
typedef cthread_t ldap_int_thread_t;
|
||||
typedef ldap_int_thread_rmutex_t ldap_int_thread_mutex_recursive_t;
|
||||
typedef struct mutex ldap_int_thread_mutex_t;
|
||||
typedef struct condition ldap_int_thread_cond_t;
|
||||
typedef cthread_key_t ldap_int_thread_key_t;
|
||||
|
||||
#ifndef LDAP_INT_MUTEX_NULL
|
||||
#define LDAP_INT_MUTEX_NULL MUTEX_INITIALIZER
|
||||
#define LDAP_INT_MUTEX_FIRSTCREATE(m) ((void) 0)
|
||||
#endif
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#elif defined( HAVE_GNU_PTH )
|
||||
/***********************************
|
||||
* *
|
||||
|
@ -123,9 +123,6 @@
|
||||
/* Define to 1 if you have the <crypt.h> header file. */
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
/* Define to 1 if you have the <cthreads.h> header file. */
|
||||
#undef HAVE_CTHREADS_H
|
||||
|
||||
/* Define to 1 if you have the `ctime_r' function. */
|
||||
#undef HAVE_CTIME_R
|
||||
|
||||
@ -337,12 +334,6 @@
|
||||
/* Define to 1 if you have the <ltdl.h> header file. */
|
||||
#undef HAVE_LTDL_H
|
||||
|
||||
/* define if you have Mach Cthreads */
|
||||
#undef HAVE_MACH_CTHREADS
|
||||
|
||||
/* Define to 1 if you have the <mach/cthreads.h> header file. */
|
||||
#undef HAVE_MACH_CTHREADS_H
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
|
@ -32,10 +32,10 @@ XXSRCS = apitest.c test.c \
|
||||
turn.c ppolicy.c dds.c txn.c ldap_sync.c stctrl.c \
|
||||
assertion.c deref.c ldifutil.c ldif.c fetch.c lbase64.c
|
||||
SRCS = threads.c rdwr.c rmutex.c tpool.c rq.c \
|
||||
thr_posix.c thr_cthreads.c thr_thr.c thr_nt.c \
|
||||
thr_posix.c thr_thr.c thr_nt.c \
|
||||
thr_pth.c thr_stub.c thr_debug.c
|
||||
OBJS = threads.lo rdwr.lo rmutex.lo tpool.lo rq.lo \
|
||||
thr_posix.lo thr_cthreads.lo thr_thr.lo thr_nt.lo \
|
||||
thr_posix.lo thr_thr.lo thr_nt.lo \
|
||||
thr_pth.lo thr_stub.lo thr_debug.lo \
|
||||
bind.lo open.lo result.lo error.lo compare.lo search.lo \
|
||||
controls.lo messages.lo references.lo extended.lo cyrus.lo \
|
||||
|
@ -1,208 +0,0 @@
|
||||
/* thr_cthreads.c - wrapper for mach cthreads */
|
||||
/* $OpenLDAP$ */
|
||||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
*
|
||||
* Copyright 1998-2018 The OpenLDAP Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/* This work was initially developed by Luke Howard for inclusion
|
||||
* in U-MICH LDAP 3.3.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#if defined( HAVE_MACH_CTHREADS )
|
||||
#include "ldap_pvt_thread.h" /* Get the thread interface */
|
||||
#define LDAP_THREAD_IMPLEMENTATION
|
||||
#include "ldap_thr_debug.h" /* May rename the symbols defined below */
|
||||
|
||||
int
|
||||
ldap_int_thread_initialize( void )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_int_thread_destroy( void )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
|
||||
int detach,
|
||||
void *(*start_routine)( void *), void *arg)
|
||||
{
|
||||
*thread = cthread_fork( (cthread_fn_t) start_routine, arg);
|
||||
return ( *thread == NULL ? -1 : 0 );
|
||||
}
|
||||
|
||||
void
|
||||
ldap_pvt_thread_exit( void *retval )
|
||||
{
|
||||
cthread_exit( (any_t) retval );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
|
||||
{
|
||||
void *status;
|
||||
status = (void *) cthread_join ( thread );
|
||||
if (thread_return != NULL)
|
||||
{
|
||||
*thread_return = status;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_yield( void )
|
||||
{
|
||||
cthread_yield();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
|
||||
{
|
||||
condition_init( cond );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cond )
|
||||
{
|
||||
condition_clear( cond );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
|
||||
{
|
||||
condition_signal( cond );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
|
||||
{
|
||||
condition_broadcast( cond );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
|
||||
ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
condition_wait( cond, mutex );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
mutex_init( mutex );
|
||||
mutex->name = NULL;
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
mutex_clear( mutex );
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
mutex_lock( mutex );
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
mutex_unlock( mutex );
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mutex )
|
||||
{
|
||||
return mutex_try_lock( mutex );
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_mutex_recursive_init( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
{
|
||||
return ldap_pvt_thread_rmutex_init( mutex );
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_mutex_recursive_destroy( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
{
|
||||
return ldap_pvt_thread_rmutex_destroy( mutex );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_recursive_lock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
{
|
||||
return ldap_pvt_thread_rmutex_lock( mutex, ldap_pvt_thread_self() );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_recursive_unlock( ldap_pvt_thread_mutex_recursive_t *mutex )
|
||||
{
|
||||
return ldap_pvt_thread_rmutex_unlock( mutex, ldap_pvt_thread_self() );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_mutex_recursive_trylock( ldap_pvt_thread_mutex_recursive_t *mp )
|
||||
{
|
||||
return ldap_pvt_thread_rmutex_trylock( mp, ldap_pvt_thread_self() );
|
||||
}
|
||||
|
||||
ldap_pvt_thread_t
|
||||
ldap_pvt_thread_self( void )
|
||||
{
|
||||
return cthread_self();
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_key_create( ldap_pvt_thread_key_t *key )
|
||||
{
|
||||
return cthread_keycreate( key );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_key_destroy( ldap_pvt_thread_key_t key )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_key_setdata( ldap_pvt_thread_key_t key, void *data )
|
||||
{
|
||||
return cthread_setspecific( key, data );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_pvt_thread_key_getdata( ldap_pvt_thread_key_t key, void **data )
|
||||
{
|
||||
return cthread_getspecific( key, data );
|
||||
}
|
||||
|
||||
#endif /* HAVE_MACH_CTHREADS */
|
Loading…
Reference in New Issue
Block a user