1 /* thr_thr.c - wrappers around solaris threads */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2005 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
19 #if defined( HAVE_THR )
21 #include "ldap_pvt_thread.h"
30 ldap_int_thread_initialize( void )
36 ldap_int_thread_destroy( void )
41 #ifdef LDAP_THREAD_HAVE_SETCONCURRENCY
43 ldap_pvt_thread_set_concurrency(int n)
45 return thr_setconcurrency( n );
49 #ifdef LDAP_THREAD_HAVE_GETCONCURRENCY
51 ldap_pvt_thread_get_concurrency(void)
53 return thr_getconcurrency();
58 ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
60 void *(*start_routine)( void *),
63 return( thr_create( NULL, LDAP_PVT_THREAD_STACK_SIZE, start_routine,
64 arg, detach ? THR_DETACHED : 0, thread ) );
68 ldap_pvt_thread_exit( void *retval )
73 int ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
75 thr_join( thread, NULL, thread_return );
80 ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
82 thr_kill( thread, signo );
87 ldap_pvt_thread_yield( void )
94 ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
96 return( cond_init( cond, USYNC_THREAD, NULL ) );
100 ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
102 return( cond_signal( cond ) );
106 ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cv )
108 return( cond_broadcast( cv ) );
112 ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
113 ldap_pvt_thread_mutex_t *mutex )
115 return( cond_wait( cond, mutex ) );
119 ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cv )
121 return( cond_destroy( cv ) );
125 ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
127 return( mutex_init( mutex, USYNC_THREAD, NULL ) );
131 ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
133 return( mutex_destroy( mutex ) );
137 ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
139 return( mutex_lock( mutex ) );
143 ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
145 return( mutex_unlock( mutex ) );
149 ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp )
151 return( mutex_trylock( mp ) );
155 ldap_pvt_thread_self( void )
160 #endif /* HAVE_THR */