Commit bd1a1b70 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

ITS#452: Added GNU Pth support (--with-threads=pth).

Ported from OpenLDAP-devel by Wes Craig <wes@umich.edu>
parent 222904d4
......@@ -4,6 +4,7 @@ Changes included in OpenLDAP 1.2.10 Release Engineering
CVS Tag: OPENLDAP_REL_ENG_1_2
Add slapd -DSLAPD_UNDEFINED_OC_IS_NOT_EXTENSIBLE macro disable
undefined object classes implies extensible object behavior.
Add GNU Pth support (ITS#453)
Changed -lldap to ignore space in filter: ( !(foo=bar)) (ITS#459)
Fixed multiple password support (ITS#464)
Fixed back-ldbm/bind invalid credentials vs no such object bug
......
This diff is collapsed.
......@@ -58,7 +58,7 @@ OL_ARG_ENABLE(dmalloc,[ --enable-dmalloc enable debug malloc support], no)dnl
OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos],
auto, [auto k5 k4 afs yes no])
OL_ARG_WITH(threads,[ --with-threads use threads],
auto, [auto posix mach lwp yes no manual] )
auto, [auto posix mach pth lwp yes no manual] )
OL_ARG_WITH(yielding_select,[ --with-yielding-select with implicitly yielding select],
auto, [auto yes no manual] )
......@@ -969,6 +969,28 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
fi
fi
if test $ol_with_threads = auto -o $ol_with_threads = yes \
-o $ol_with_threads = pth ; then
dnl check for GNU Pth
AC_CHECK_HEADERS(pth.h)
if test $ac_cv_header_pth_h = yes ; then
dnl check for pth lib
AC_CHECK_LIB(pth,pth_version,[have_pth=yes],[have_pth=no])
if test $have_pth = yes ; then
AC_DEFINE(HAVE_GNU_PTH,1,[if you have GNU Pth])
LTHREAD_LIBS="$LTHREAD_LIBS -lpth"
ol_link_threads=pth
fi
if test $ol_with_yielding_select = auto ; then
ol_with_yielding_select=yes
fi
fi
fi
if test $ol_with_threads = auto -o $ol_with_threads = yes \
-o $ol_with_threads = lwp ; then
......
......@@ -67,6 +67,26 @@ typedef struct condition ldap_pvt_thread_cond_t;
LDAP_END_DECL
#elif defined( HAVE_GNU_PTH )
/***********************************
* *
* thread definitions for GNU Pth *
* *
***********************************/
#include <pth.h>
LDAP_BEGIN_DECL
typedef pth_t ldap_pvt_thread_t;
typedef pth_mutex_t ldap_pvt_thread_mutex_t;
typedef pth_cond_t ldap_pvt_thread_cond_t;
/* XXX Sun? */
#define _POSIX_PTHREAD_SEMANTICS 1
LDAP_END_DECL
#elif defined( HAVE_THR )
/********************************************
* *
......
......@@ -406,6 +406,9 @@
/* Define if you have the <psap.h> header file. */
#undef HAVE_PSAP_H
/* Define if you have the <pth.h> header file. */
#undef HAVE_PTH_H
/* Define if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
......@@ -562,6 +565,9 @@
/* define if you have Mach Cthreads */
#undef HAVE_MACH_CTHREADS
/* if you have GNU Pth */
#undef HAVE_GNU_PTH
/* if you have Solaris LWP (thr) package */
#undef HAVE_THR
......
......@@ -6,10 +6,10 @@ LIBRARY = liblthread.a
XSRCS = version.c
SRCS = rdwr.c thr_sleep.c thr_stub.c \
thr_cthreads.c thr_lwp.c thr_nt.c thr_posix.c thr_thr.c
thr_cthreads.c thr_lwp.c thr_nt.c thr_posix.c thr_thr.c thr_pth.c
OBJS = rdwr.o thr_sleep.o thr_stub.o \
thr_cthreads.o thr_lwp.o thr_nt.o thr_posix.o thr_thr.o
thr_cthreads.o thr_lwp.o thr_nt.o thr_posix.o thr_thr.o thr_pth.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
......
/*
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted only
* as authorized by the OpenLDAP Public License. A copy of this
* license is available at http://www.OpenLDAP.org/license.html or
* in file LICENSE in the top-level directory of the distribution.
*/
/* thr_pth.c - wrappers around GNU Pth */
#include "portable.h"
#if defined( HAVE_GNU_PTH )
#include "ldap_pvt_thread.h"
/*******************
* *
* GNU Pth Threads *
* *
*******************/
static pth_attr_t detach_attr;
int
ldap_pvt_thread_initialize( void )
{
detach_attr = pth_attr_new();
pth_attr_set( detach_attr, PTH_ATTR_JOINABLE, 0 );
return pth_init();
}
int
ldap_pvt_thread_destroy( void )
{
pth_attr_destroy(detach_attr);
pth_kill();
return( 0 );
}
int
ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
int detach,
void *(*start_routine)( void *),
void *arg)
{
*thread = pth_spawn( detach ? detach_attr : PTH_ATTR_DEFAULT,
start_routine, arg );
return( *thread == NULL );
}
void
ldap_pvt_thread_exit( void *retval )
{
pth_exit( retval );
}
int ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
{
return( pth_join( thread, thread_return ));
}
int
ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
{
return( pth_raise( thread, signo ));
}
int
ldap_pvt_thread_yield( void )
{
return( pth_yield( NULL ));
}
int
ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
{
return( pth_cond_init( cond ) );
}
int
ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
{
return( pth_cond_notify( cond, 0 ) );
}
int
ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
{
return( pth_cond_notify( cond, 1 ) );
}
int
ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
ldap_pvt_thread_mutex_t *mutex )
{
return( pth_cond_await( cond, mutex, NULL ) );
}
int
ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
{
return 0;
}
int
ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
{
return( pth_mutex_init( mutex ) );
}
int
ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
{
return 0;
}
int
ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
{
pth_init();
return( pth_mutex_acquire( mutex, 0, NULL ) );
}
int
ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
{
return( pth_mutex_release( mutex ) );
}
int
ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mutex )
{
return( pth_mutex_acquire( mutex, 1, NULL ) );
}
#endif /* HAVE_GNU_PTH */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment