Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 868 vs 869 for /trunk/Source Code/Core/Console.cpp

Diff revisions: vs.
  @@ -17,7 +17,9 @@
17 17 std::atomic_bool Console::_running;
18 18 Console::ConsolePrintCallback Console::_guiConsoleCallback;
19 19
20 - moodycamel::BlockingConcurrentQueue<Console::OutputEntry> Console::_outputBuffer(MAX_CONSOLE_ENTRIES);
20 + //Use moodycamel's implementation of a concurent queue due to its "Knock-your-socks-off blazing fast performance."
21 + //https://github.com/cameron314/concurrentqueue
22 + moodycamel::ConcurrentQueue<Console::OutputEntry> Console::_outputBuffer(MAX_CONSOLE_ENTRIES);
21 23
22 24 //! Do not remove the following license without express permission granted by DIVIDE-Studio
23 25 void Console::printCopyrightNotice() {
  @@ -110,12 +112,15 @@
110 112 //moodycamel::ConsumerToken ctok(_outputBuffer);
111 113 while (_running) {
112 114 OutputEntry entry;
113 - _outputBuffer.wait_dequeue(/*ctok, */entry);
114 - std::ostream& outStream = entry._error ? std::cerr : std::cout;
115 - outStream << entry._text.c_str();
116 -
117 - if (_guiConsoleCallback) {
118 - _guiConsoleCallback(entry._text.c_str(), entry._error);
115 + if (_outputBuffer.try_dequeue(/*ctok, */entry)) {
116 + std::ostream& outStream = entry._error ? std::cerr : std::cout;
117 + outStream << entry._text.c_str();
118 +
119 + if (_guiConsoleCallback) {
120 + _guiConsoleCallback(entry._text.c_str(), entry._error);
121 + }
122 + } else {
123 + std::this_thread::sleep_for(std::chrono::milliseconds(16));
119 124 }
120 125 }
121 126 }