Browse Source

Remove single cpu decoder shortcut

Single CPU machines are extremely rare now, so let's avoid the hassle of
multiple code paths.
tags/v1.12.90
Pierre Ossman 2 years ago
parent
commit
195388d3aa
1 changed files with 1 additions and 27 deletions
  1. 1
    27
      common/rfb/DecodeManager.cxx

+ 1
- 27
common/rfb/DecodeManager.cxx View File

@@ -57,19 +57,9 @@ DecodeManager::DecodeManager(CConnection *conn) :
// wasting CPU fighting for locks
if (cpuCount > 4)
cpuCount = 4;
// The overhead of threading is small, but not small enough to
// ignore on single CPU systems
if (cpuCount == 1)
vlog.info("Decoding data on main thread");
else
vlog.info("Creating %d decoder thread(s)", (int)cpuCount);
}

if (cpuCount == 1) {
// Threads are not used on single CPU machines
freeBuffers.push_back(new rdr::MemOutStream());
return;
}
vlog.info("Creating %d decoder thread(s)", (int)cpuCount);

while (cpuCount--) {
// Twice as many possible entries in the queue as there
@@ -128,22 +118,6 @@ bool DecodeManager::decodeRect(const Rect& r, int encoding,

decoder = decoders[encoding];

// Fast path for single CPU machines to avoid the context
// switching overhead
if (threads.empty()) {
bufferStream = freeBuffers.front();
bufferStream->clear();
if (!decoder->readRect(r, conn->getInStream(), conn->server, bufferStream))
return false;
try {
decoder->decodeRect(r, bufferStream->data(), bufferStream->length(),
conn->server, pb);
} catch (rdr::Exception& e) {
throw Exception("Error decoding rect: %s", e.str());
}
return true;
}

// Wait for an available memory buffer
queueMutex->lock();


Loading…
Cancel
Save