summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhansong Gao <zhsgao@hotmail.com>2022-11-30 16:01:50 +0800
committerNikolaus Rath <Nikolaus@rath.org>2022-12-01 09:20:54 +0000
commit5aaec929a4e4fe1f3113e4dc6a1469090511207b (patch)
tree9029b2e6aa6abb605418771ef88c208b481b4a0a
parent777663953382925c7403f0560c28ec9bbd14d7be (diff)
downloadfuse-5aaec929a4e4fe1f3113e4dc6a1469090511207b.tar.gz
Make it work even if max_idle_threads is set to 0
It may happen that none of the worker threads are running if max_idle_threads is set to 0 although few people will do this. Adding a limit of keeping at least one worker thread will make our code more rigorous. Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
-rw-r--r--lib/fuse_loop_mt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c
index 6002e19..72c74a8 100644
--- a/lib/fuse_loop_mt.c
+++ b/lib/fuse_loop_mt.c
@@ -179,7 +179,7 @@ static void *fuse_do_work(void *data)
* is indeed a good reason to destruct threads it should be done
* delayed, a moving average might be useful for that.
*/
- if (mt->max_idle != -1 && mt->numavail > mt->max_idle) {
+ if (mt->max_idle != -1 && mt->numavail > mt->max_idle && mt->numworker > 1) {
if (mt->exit) {
pthread_mutex_unlock(&mt->lock);
return NULL;