3 * Copyright 1998-2000 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_stub.c - stubs for the threads */
16 #if defined( NO_THREADS )
18 #include "ldap_pvt_thread.h"
20 /***********************************************************************
22 * no threads package defined for this system - fake ok returns from *
23 * all threads routines (making it single-threaded). *
25 ***********************************************************************/
28 ldap_int_thread_initialize( void )
34 ldap_int_thread_destroy( void )
39 static void* ldap_int_status = NULL;
42 ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
44 void *(*start_routine)(void *),
47 if( ! detach ) ldap_int_status = NULL;
53 ldap_pvt_thread_exit( void *retval )
55 if( retval != NULL ) {
56 ldap_int_status = retval;
62 ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **status )
64 if(status != NULL) *status = ldap_int_status;
69 ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
75 ldap_pvt_thread_yield( void )
81 ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
87 ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cond )
93 ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
99 ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
105 ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
106 ldap_pvt_thread_mutex_t *mutex )
112 ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
118 ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
124 ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
130 ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mutex )
136 ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
142 * NO_THREADS requires a separate tpool implementation since
143 * generic ldap_pvt_thread_pool_wrapper loops forever.
146 ldap_pvt_thread_pool_init (
147 ldap_pvt_thread_pool_t *pool_out,
148 int max_concurrency, int max_pending )
150 *pool_out = (ldap_pvt_thread_pool_t) 0;
155 ldap_pvt_thread_pool_submit (
156 ldap_pvt_thread_pool_t *pool,
157 void *(*start_routine)( void * ), void *arg )
159 (start_routine)(arg);
164 ldap_pvt_thread_pool_maxthreads ( ldap_pvt_thread_pool_t *tpool, int max_threads )
170 ldap_pvt_thread_pool_backload (
171 ldap_pvt_thread_pool_t *pool )
177 ldap_pvt_thread_pool_destroy (
178 ldap_pvt_thread_pool_t *pool, int run_pending )
183 #endif /* NO_THREADS */