3 * Copyright 1998-2003 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.
16 #include <ac/stdarg.h>
17 #include <ac/stdlib.h>
18 #include <ac/string.h>
19 #include <ac/unistd.h>
21 #include "ldap_pvt_thread.h"
25 * Common LDAP thread routines
26 * see thr_*.c for implementation specific routines
27 * see rdwr.c for generic reader/writer lock implementation
28 * see tpool.c for generic thread pool implementation
32 int ldap_pvt_thread_initialize( void )
37 /* we only get one shot at this */
38 if( init++ ) return -1;
40 rc = ldap_int_thread_initialize();
43 #ifndef LDAP_THREAD_HAVE_TPOOL
44 rc = ldap_int_thread_pool_startup();
51 int ldap_pvt_thread_destroy( void )
53 #ifndef LDAP_THREAD_HAVE_TPOOL
54 (void) ldap_int_thread_pool_shutdown();
56 return ldap_int_thread_destroy();
59 #ifndef LDAP_THREAD_HAVE_GETCONCURRENCY
61 ldap_pvt_thread_get_concurrency ( void )
67 #ifndef LDAP_THREAD_HAVE_SETCONCURRENCY
69 ldap_pvt_thread_set_concurrency ( int concurrency )
75 #ifndef LDAP_THREAD_HAVE_SLEEP
77 * Here we assume we have fully preemptive threads and that sleep()
78 * does the right thing.
81 ldap_pvt_thread_sleep(