* Send the queued Debug messages to either NetworkAdminConsole or IConsolePrint from the * GameLoop thread to prevent concurrent accesses to both the NetworkAdmin's packet queue * as well as IConsolePrint's buffers. * * This is to be called from the GameLoop thread. */
| 233 | * This is to be called from the GameLoop thread. |
| 234 | */ |
| 235 | void DebugSendRemoteMessages() |
| 236 | { |
| 237 | if (!_debug_remote_console.load()) return; |
| 238 | |
| 239 | { |
| 240 | std::lock_guard<std::mutex> lock(_debug_remote_console_mutex); |
| 241 | std::swap(_debug_remote_console_queue, _debug_remote_console_queue_spare); |
| 242 | } |
| 243 | |
| 244 | for (auto &item : _debug_remote_console_queue_spare) { |
| 245 | NetworkAdminConsole(item.level, item.message); |
| 246 | if (_settings_client.gui.developer >= 2) IConsolePrint(CC_DEBUG, "dbg: [{}] {}", item.level, item.message); |
| 247 | } |
| 248 | |
| 249 | _debug_remote_console_queue_spare.clear(); |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * Reconsider whether we need to send debug messages to either NetworkAdminConsole |
no test coverage detected