2 * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
5 * Redistribution and use in source and binary forms are permitted only
6 * as authorized by the OpenLDAP Public License. A copy of this
7 * license is available at http://www.OpenLDAP.org/license.html or
8 * in file LICENSE in the top-level directory of the distribution.
11 /* thr_thr.c - wrappers around solaris threads */
14 #include "ldap_pvt_thread.h"
16 #if defined( HAVE_THR )
25 ldap_pvt_thread_initialize( void )
27 #ifdef LDAP_THREAD_CONCURRENCY
28 thr_setconcurrency( LDAP_THREAD_CONCURRENCY );
34 ldap_pvt_thread_set_concurrency(int n)
36 return thr_setconcurrency( n );
40 ldap_pvt_thread_get_concurrency(void)
42 return thr_getconcurrency();
46 ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
48 void *(*start_routine)( void *),
51 return( thr_create( NULL, 0, start_routine, arg,
52 detach ? THR_DETACHED : 0,
57 ldap_pvt_thread_exit( void *retval )
62 int ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
64 thr_join( thread, NULL, thread_return );
69 ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
71 thr_kill( thread, signo );
76 ldap_pvt_thread_yield( void )
83 ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
85 return( cond_init( cond, USYNC_THREAD, NULL ) );
89 ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
91 return( cond_signal( cond ) );
95 ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cv )
97 return( cond_broadcast( cv ) );
101 ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
102 ldap_pvt_thread_mutex_t *mutex )
104 return( cond_wait( cond, mutex ) );
108 ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
110 return( cond_destroy( cv ) );
114 ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
116 return( mutex_init( mutex, USYNC_THREAD, NULL ) );
120 ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
122 return( mutex_destroy( mutex ) );
126 ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
128 return( mutex_lock( mutex ) );
132 ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
134 return( mutex_unlock( mutex ) );
138 ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
140 return( mutex_trylock( mp ) );
143 #endif /* HAVE_THR */