From 3b6163f5870cb7cfcddff0db320c1f29cbc8fadf Mon Sep 17 00:00:00 2001 From: Mateusz Jakub Fila Date: Thu, 9 Apr 2026 16:08:46 +0200 Subject: [PATCH] synchronize printouts --- examples/logging_utils.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/logging_utils.hpp b/examples/logging_utils.hpp index 8a1609d..837e4ed 100644 --- a/examples/logging_utils.hpp +++ b/examples/logging_utils.hpp @@ -3,14 +3,15 @@ #include #include #include +#include #include -static inline std::ostream& log() { - return std::cout << std::this_thread::get_id() << " "; +static inline auto log() { + return std::osyncstream(std::cout) << std::this_thread::get_id() << " "; } -static inline std::ostream& log(std::string_view self) { - return std::cout << std::this_thread::get_id() << " " << self << " "; +static inline auto log(std::string_view self) { + return log() << self << " "; } static inline std::string format_name(std::string_view parent,