diff options
author | Stefan Metzmacher <metze@samba.org> | 2018-04-20 17:12:07 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2018-07-12 14:25:19 +0200 |
commit | 59768416148f72d87cba80ae21afbb2861ca9442 (patch) | |
tree | f858a0b7970fb13bfea0d0c4932d5fb5eab3d1d2 /lib/pthreadpool | |
parent | 4e54543b54ea2bc71f5524a41d359376b8f59125 (diff) | |
download | samba-59768416148f72d87cba80ae21afbb2861ca9442.tar.gz |
pthreadpool: don't process further jobs when shutting down
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib/pthreadpool')
-rw-r--r-- | lib/pthreadpool/pthreadpool.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/pthreadpool/pthreadpool.c b/lib/pthreadpool/pthreadpool.c index 55ea36ed023..1ef6dccee62 100644 --- a/lib/pthreadpool/pthreadpool.c +++ b/lib/pthreadpool/pthreadpool.c @@ -444,6 +444,10 @@ static void pthreadpool_server_exit(struct pthreadpool *pool) static bool pthreadpool_get_job(struct pthreadpool *p, struct pthreadpool_job *job) { + if (p->shutdown) { + return false; + } + if (p->num_jobs == 0) { return false; } @@ -601,10 +605,9 @@ static void *pthreadpool_server(void *arg) } } - if ((pool->num_jobs == 0) && pool->shutdown) { + if (pool->shutdown) { /* - * No more work to do and we're asked to shut down, so - * exit + * we're asked to shut down, so exit */ pthreadpool_server_exit(pool); return NULL; |