*/
u_int threads;
+ /**
+ * Current number of busy threads
+ */
+ u_int busy_threads;
+
/**
* TRUE if no new queries are accepted
*/
thread_cancelability(old);
thread_cleanup_pop(FALSE);
}
+ this->busy_threads++;
this->mutex->unlock(this->mutex);
memset(&hints, 0, sizeof(hints));
thread_cleanup_pop(FALSE);
this->mutex->lock(this->mutex);
+ this->busy_threads--;
if (error != 0)
{
DBG1(DBG_LIB, "resolving '%s' failed: %s", query->name,
this->new_query->signal(this->new_query);
}
ref_get(&query->refcount);
- if (this->threads < this->max_threads)
+ if (this->busy_threads == this->threads &&
+ this->threads < this->max_threads)
{
this->threads++;
lib->processor->queue_job(lib->processor,