3 * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
12 /* thr_thr.c - wrappers around solaris threads */
16 #if defined( HAVE_THR )
18 #include "ldap_pvt_thread.h"
27 ldap_int_thread_initialize( void )
33 ldap_int_thread_destroy( void )
38 #ifdef LDAP_THREAD_HAVE_SETCONCURRENCY
40 ldap_pvt_thread_set_concurrency(int n)
42 return thr_setconcurrency( n );
46 #ifdef LDAP_THREAD_HAVE_GETCONCURRENCY
48 ldap_pvt_thread_get_concurrency(void)
50 return thr_getconcurrency();
55 ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
57 void *(*start_routine)( void *),
60 return( thr_create( NULL, LDAP_PVT_THREAD_STACK_SIZE, start_routine,
61 arg, detach ? THR_DETACHED : 0, thread ) );
65 ldap_pvt_thread_exit( void *retval )
70 int ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
72 thr_join( thread, NULL, thread_return );
77 ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
79 thr_kill( thread, signo );
84 ldap_pvt_thread_yield( void )
91 ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
93 return( cond_init( cond, USYNC_THREAD, NULL ) );
97 ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
99 return( cond_signal( cond ) );
103 ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cv )
105 return( cond_broadcast( cv ) );
109 ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
110 ldap_pvt_thread_mutex_t *mutex )
112 return( cond_wait( cond, mutex ) );
116 ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
118 return( cond_destroy( cv ) );
122 ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
124 return( mutex_init( mutex, USYNC_THREAD, NULL ) );
128 ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
130 return( mutex_destroy( mutex ) );
134 ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
136 return( mutex_lock( mutex ) );
140 ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
142 return( mutex_unlock( mutex ) );
146 ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
148 return( mutex_trylock( mp ) );
152 ldap_pvt_thread_self( void )
157 #endif /* HAVE_THR */