#include "portable.h"
+#include <stdio.h>
+#include <stdarg.h>
+
#include <ac/stdlib.h>
#include <ac/string.h>
int need_thread = 0;
ldap_pvt_thread_t thr;
- return ldap_pvt_thread_create( &thr, 1, (void *)start_routine, arg );
-
if (pool == NULL)
return(-1);
}
pool->ltp_pending_count++;
ldap_pvt_thread_enlist(&pool->ltp_pending_list, ctx);
- if ((pool->ltp_open_count <= 0 || pool->ltp_open_count == pool->ltp_active_count)
- && (pool->ltp_max_count <= 0 || pool->ltp_open_count < pool->ltp_max_count))
+ ldap_pvt_thread_cond_signal(&pool->ltp_cond);
+ if ((pool->ltp_open_count <= 0
+ || pool->ltp_pending_count > 1
+ || pool->ltp_open_count == pool->ltp_active_count)
+ && (pool->ltp_max_count <= 0
+ || pool->ltp_open_count < pool->ltp_max_count))
{
pool->ltp_open_count++;
need_thread = 1;
}
}
- ldap_pvt_thread_cond_signal(&pool->ltp_cond);
return(0);
}
while (pool->ltp_state != LDAP_PVT_THREAD_POOL_STOPPING) {
- if (pool->ltp_state == LDAP_PVT_THREAD_POOL_RUNNING) {
- ldap_pvt_thread_cond_wait(&pool->ltp_cond, &pool->ltp_mutex);
- if (pool->ltp_state == LDAP_PVT_THREAD_POOL_STOPPING)
- break;
- }
-
ctx = ldap_pvt_thread_delist(&pool->ltp_pending_list, NULL);
if (ctx == NULL) {
if (pool->ltp_state == LDAP_PVT_THREAD_POOL_FINISHING)
* only die if there are other open threads (i.e.,
* always have at least one thread open).
*/
+ if (pool->ltp_state == LDAP_PVT_THREAD_POOL_RUNNING)
+ ldap_pvt_thread_cond_wait(&pool->ltp_cond, &pool->ltp_mutex);
+
continue;
}
return(NULL);
}
+
#endif /* NO_THREADS */