From 75dd924f3aa42eac7eb1a397854c5475f4c24df3 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 29 Mar 2013 17:07:42 -0700 Subject: [PATCH] Don't spin when an IO+ thread returns to the job queue. --- src/cpp/ripple/JobQueue.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cpp/ripple/JobQueue.cpp b/src/cpp/ripple/JobQueue.cpp index d169a9dda..ccd992da2 100644 --- a/src/cpp/ripple/JobQueue.cpp +++ b/src/cpp/ripple/JobQueue.cpp @@ -291,12 +291,19 @@ void JobQueue::threadEntry() while (1) { NameThread("waiting"); + bool didIO = false; while (mJobSet.empty() && !mShuttingDown) { - if ((mIOThreadCount < mMaxIOThreadCount) && !theApp->isShutdown()) + if ((mIOThreadCount < mMaxIOThreadCount) && !didIO && !theApp->isShutdown()) + { IOThread(sl); + didIO = true; + } else + { mJobCond.wait(sl); + didIO = false; + } } if (mShuttingDown)