/*
* maximum number of threads
+ * 0 means no real thread, only strict sync processing.
*/
unsigned max_threads;
return EINVAL;
}
+ if (pool->max_threads == 0) {
+ unlock_res = pthread_mutex_unlock(&pool->mutex);
+ assert(unlock_res == 0);
+
+ /*
+ * If no thread are allowed we do strict sync processing.
+ */
+ fn(private_data);
+ res = pool->signal_fn(job_id, fn, private_data,
+ pool->signal_fn_private_data);
+ return res;
+ }
+
/*
* Add job to the end of the queue
*/
return res;
}
- if ((pool->max_threads != 0) &&
- (pool->num_threads >= pool->max_threads)) {
+ if (pool->num_threads >= pool->max_threads) {
/*
* No more new threads, we just queue the request
*/
unlock_res = pthread_mutex_unlock(&pool->mutex);
assert(unlock_res == 0);
- fn(private_data);
- res = pool->signal_fn(job_id, fn, private_data,
- pool->signal_fn_private_data);
return res;
}