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.
17 #include <ac/stdlib.h>
18 #include <ac/string.h>
20 #include "ldap_pvt_thread.h"
24 * Common LDAP thread routines
25 * see thr_*.c for implementation specific routines
26 * see rdwr.c for generic reader/writer lock implementation
27 * see tpool.c for generic thread pool implementation
31 int ldap_pvt_thread_initialize( void )
36 /* we only get one shot at this */
37 if( init++ ) return -1;
39 rc = ldap_int_thread_initialize();
42 #ifndef LDAP_THREAD_HAVE_TPOOL
43 rc = ldap_int_thread_pool_startup();
50 int ldap_pvt_thread_destroy( void )
52 #ifndef LDAP_THREAD_HAVE_TPOOL
53 (void) ldap_int_thread_pool_shutdown();
55 return ldap_int_thread_destroy();
58 #ifndef LDAP_THREAD_HAVE_GETCONCURRENCY
60 ldap_pvt_thread_get_concurrency ( void )
66 #ifndef LDAP_THREAD_HAVE_SETCONCURRENCY
68 ldap_pvt_thread_set_concurrency ( int concurrency )
74 #ifndef LDAP_THREAD_HAVE_SLEEP
76 * Here we assume we have fully preemptive threads and that sleep()
77 * does the right thing.
80 ldap_pvt_thread_sleep(