Terrasync: don't busy wait when no requests are running.
This commit is contained in:
@@ -643,6 +643,12 @@ void SGTerraSync::SvnThread::runInternal()
|
||||
}
|
||||
|
||||
_busy = anySlotBusy;
|
||||
if (!anySlotBusy) {
|
||||
// wait on the blocking deque here, otherwise we spin
|
||||
// the loop very fast, since _http::update with no connections
|
||||
// active returns immediately.
|
||||
waitingTiles.waitOnNotEmpty();
|
||||
}
|
||||
} // of thread running loop
|
||||
}
|
||||
|
||||
|
||||
@@ -386,6 +386,11 @@ public:
|
||||
return this->queue.size();
|
||||
}
|
||||
|
||||
void waitOnNotEmpty() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
while (this->queue.empty())
|
||||
not_empty.wait(mutex);
|
||||
}
|
||||
private:
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user