From ef0c2a926899e91e1ea0503ede5dc2e747079db3 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 1 May 2020 18:45:51 +0200 Subject: [PATCH] Save a call to stopThreadedIOIfNeeded() for the base case. Probably no performance changes, but the code should be trivial to read as in "No threading? Use the normal function and return". --- src/networking.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/networking.c b/src/networking.c index 767206ab9..d4c0306c3 100644 --- a/src/networking.c +++ b/src/networking.c @@ -2997,9 +2997,9 @@ int handleClientsWithPendingWritesUsingThreads(void) { int processed = listLength(server.clients_pending_write); if (processed == 0) return 0; /* Return ASAP if there are no clients. */ - /* If we have just a few clients to serve, don't use I/O threads, but the - * boring synchronous code. */ - if (stopThreadedIOIfNeeded()) { + /* If I/O threads are disabled or we have few clients to serve, don't + * use I/O threads, but thejboring synchronous code. */ + if (server.io_threads_num == 1 || stopThreadedIOIfNeeded()) { return handleClientsWithPendingWrites(); }