1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

pthreadpool: Add some asserts

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Dec 13 00:44:57 CET 2017 on sn-devel-144
This commit is contained in:
Volker Lendecke 2017-12-12 13:58:48 +01:00 committed by Jeremy Allison
parent 74aa416be7
commit 6c9ac731df

View File

@ -652,11 +652,13 @@ int pthreadpool_add_job(struct pthreadpool *pool, int job_id,
* Add job to the end of the queue * Add job to the end of the queue
*/ */
if (!pthreadpool_put_job(pool, job_id, fn, private_data)) { if (!pthreadpool_put_job(pool, job_id, fn, private_data)) {
pthread_mutex_unlock(&pool->mutex); res = pthread_mutex_unlock(&pool->mutex);
assert(res == 0);
return ENOMEM; return ENOMEM;
} }
if (pool->num_idle > 0) { if (pool->num_idle > 0) {
int unlock_res;
/* /*
* We have idle threads, wake one. * We have idle threads, wake one.
*/ */
@ -664,7 +666,8 @@ int pthreadpool_add_job(struct pthreadpool *pool, int job_id,
if (res != 0) { if (res != 0) {
pthreadpool_undo_put_job(pool); pthreadpool_undo_put_job(pool);
} }
pthread_mutex_unlock(&pool->mutex); unlock_res = pthread_mutex_unlock(&pool->mutex);
assert(unlock_res == 0);
return res; return res;
} }
@ -673,7 +676,8 @@ int pthreadpool_add_job(struct pthreadpool *pool, int job_id,
/* /*
* No more new threads, we just queue the request * No more new threads, we just queue the request
*/ */
pthread_mutex_unlock(&pool->mutex); res = pthread_mutex_unlock(&pool->mutex);
assert(res == 0);
return 0; return 0;
} }