Back to index

openldap  2.4.31
thr_stub.c
Go to the documentation of this file.
00001 /* thr_stub.c - stubs for the threads */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 1998-2012 The OpenLDAP Foundation.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted only as authorized by the OpenLDAP
00010  * Public License.
00011  *
00012  * A copy of this license is available in file LICENSE in the
00013  * top-level directory of the distribution or, alternatively, at
00014  * <http://www.OpenLDAP.org/license.html>.
00015  */
00016 
00017 #include "portable.h"
00018 
00019 #if defined( NO_THREADS )
00020 
00021 #include "ldap_pvt_thread.h" /* Get the thread interface */
00022 #define LDAP_THREAD_IMPLEMENTATION
00023 #define LDAP_THREAD_POOL_IMPLEMENTATION
00024 #include "ldap_thr_debug.h"  /* May rename the symbols defined below */
00025 
00026 /***********************************************************************
00027  *                                                                     *
00028  * no threads package defined for this system - fake ok returns from   *
00029  * all threads routines (making it single-threaded).                   *
00030  *                                                                     *
00031  ***********************************************************************/
00032 
00033 int
00034 ldap_int_thread_initialize( void )
00035 {
00036        return 0;
00037 }
00038 
00039 int
00040 ldap_int_thread_destroy( void )
00041 {
00042        return 0;
00043 }
00044 
00045 static void* ldap_int_status = NULL;
00046 
00047 int 
00048 ldap_pvt_thread_create( ldap_pvt_thread_t * thread, 
00049        int detach,
00050        void *(*start_routine)(void *),
00051        void *arg)
00052 {
00053        if( ! detach ) ldap_int_status = NULL;
00054        start_routine( arg );
00055        return 0;
00056 }
00057 
00058 void 
00059 ldap_pvt_thread_exit( void *retval )
00060 {
00061        if( retval != NULL ) {
00062               ldap_int_status = retval;
00063        }
00064        return;
00065 }
00066 
00067 int 
00068 ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **status )
00069 {
00070        if(status != NULL) *status = ldap_int_status;
00071        return 0;
00072 }
00073 
00074 int 
00075 ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
00076 {
00077        return 0;
00078 }
00079 
00080 int 
00081 ldap_pvt_thread_yield( void )
00082 {
00083        return 0;
00084 }
00085 
00086 int 
00087 ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
00088 {
00089        return 0;
00090 }
00091 
00092 int 
00093 ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cond )
00094 {
00095        return 0;
00096 }
00097 
00098 int 
00099 ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
00100 {
00101        return 0;
00102 }
00103 
00104 int 
00105 ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
00106 {
00107        return 0;
00108 }
00109 
00110 int 
00111 ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond,
00112                        ldap_pvt_thread_mutex_t *mutex )
00113 {
00114        return 0;
00115 }
00116 
00117 int 
00118 ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
00119 {
00120        return 0;
00121 }
00122 
00123 int 
00124 ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
00125 {
00126        return 0;
00127 }
00128 
00129 int 
00130 ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
00131 {
00132        return 0;
00133 }
00134 
00135 int 
00136 ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mutex )
00137 {
00138        return 0;
00139 }
00140 
00141 int 
00142 ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
00143 {
00144        return 0;
00145 }
00146 
00147 /*
00148  * NO_THREADS requires a separate tpool implementation since
00149  * generic ldap_pvt_thread_pool_wrapper loops forever.
00150  */
00151 int
00152 ldap_pvt_thread_pool_init (
00153        ldap_pvt_thread_pool_t *pool_out,
00154        int max_concurrency, int max_pending )
00155 {
00156        *pool_out = (ldap_pvt_thread_pool_t) 0;
00157        return(0);
00158 }
00159 
00160 int
00161 ldap_pvt_thread_pool_submit (
00162        ldap_pvt_thread_pool_t *pool,
00163        ldap_pvt_thread_start_t *start_routine, void *arg )
00164 {
00165        (start_routine)(NULL, arg);
00166        return(0);
00167 }
00168 
00169 int
00170 ldap_pvt_thread_pool_retract (
00171        ldap_pvt_thread_pool_t *pool,
00172        ldap_pvt_thread_start_t *start_routine, void *arg )
00173 {
00174        return(0);
00175 }
00176 
00177 int
00178 ldap_pvt_thread_pool_maxthreads ( ldap_pvt_thread_pool_t *tpool, int max_threads )
00179 {
00180        return(0);
00181 }
00182 
00183 int
00184 ldap_pvt_thread_pool_query( ldap_pvt_thread_pool_t *tpool,
00185        ldap_pvt_thread_pool_param_t param, void *value )
00186 {
00187        *(int *)value = -1;
00188        return(-1);
00189 }
00190 
00191 int
00192 ldap_pvt_thread_pool_backload (
00193        ldap_pvt_thread_pool_t *pool )
00194 {
00195        return(0);
00196 }
00197 
00198 int
00199 ldap_pvt_thread_pool_destroy (
00200        ldap_pvt_thread_pool_t *pool, int run_pending )
00201 {
00202        return(0);
00203 }
00204 
00205 void
00206 ldap_pvt_thread_pool_idle ( ldap_pvt_thread_pool_t *pool )
00207 {
00208        return;
00209 }
00210 
00211 void
00212 ldap_pvt_thread_pool_unidle ( ldap_pvt_thread_pool_t *pool )
00213 {
00214        return;
00215 }
00216 
00217 int ldap_pvt_thread_pool_getkey (
00218        void *ctx, void *key, void **data, ldap_pvt_thread_pool_keyfree_t **kfree )
00219 {
00220        return(0);
00221 }
00222 
00223 int ldap_pvt_thread_pool_setkey (
00224        void *ctx, void *key,
00225        void *data, ldap_pvt_thread_pool_keyfree_t *kfree,
00226        void **olddatap, ldap_pvt_thread_pool_keyfree_t **oldkfreep )
00227 {
00228        if ( olddatap ) *olddatap = NULL;
00229        if ( oldkfreep ) *oldkfreep = 0;
00230        return(0);
00231 }
00232 
00233 void ldap_pvt_thread_pool_purgekey( void *key )
00234 {
00235 }
00236 
00237 int ldap_pvt_thread_pool_pause ( 
00238        ldap_pvt_thread_pool_t *tpool )
00239 {
00240        return(0);
00241 }
00242 
00243 int ldap_pvt_thread_pool_resume ( 
00244        ldap_pvt_thread_pool_t *tpool )
00245 {
00246        return(0);
00247 }
00248 
00249 int ldap_pvt_thread_pool_pausing( ldap_pvt_thread_pool_t *tpool )
00250 {
00251        return(0);
00252 }
00253 
00254 ldap_pvt_thread_pool_pausecheck( ldap_pvt_thread_pool_t *tpool )
00255 {
00256        return(0);
00257 }
00258        
00259 void *ldap_pvt_thread_pool_context( )
00260 {
00261        return(NULL);
00262 }
00263 
00264 void ldap_pvt_thread_pool_context_reset( void *vctx )
00265 {
00266 }
00267 
00268 ldap_pvt_thread_t
00269 ldap_pvt_thread_self( void )
00270 {
00271        return(0);
00272 }
00273 
00274 int
00275 ldap_pvt_thread_key_create( ldap_pvt_thread_key_t *key )
00276 {
00277        return(0);
00278 }
00279 
00280 int
00281 ldap_pvt_thread_key_destroy( ldap_pvt_thread_key_t key )
00282 {
00283        return(0);
00284 }
00285 
00286 int
00287 ldap_pvt_thread_key_setdata( ldap_pvt_thread_key_t key, void *data )
00288 {
00289        return(0);
00290 }
00291 
00292 int
00293 ldap_pvt_thread_key_getdata( ldap_pvt_thread_key_t key, void **data )
00294 {
00295        return(0);
00296 }
00297 
00298 ldap_pvt_thread_t
00299 ldap_pvt_thread_pool_tid( void *vctx )
00300 {
00301 
00302        return(0);
00303 }
00304 
00305 #endif /* NO_THREADS */