From 7d412eccb685349a79f55120c0531cf64479c6ed Mon Sep 17 00:00:00 2001 From: vsonnier Date: Mon, 13 Feb 2017 21:51:46 +0100 Subject: [PATCH] BLOCKING_QUEUE: display current Thread id in both hex and decimal so both worlds are happy (GDB and Visual Studio) --- src/util/ThreadBlockingQueue.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/util/ThreadBlockingQueue.h b/src/util/ThreadBlockingQueue.h index ab95d93..d78b923 100644 --- a/src/util/ThreadBlockingQueue.h +++ b/src/util/ThreadBlockingQueue.h @@ -90,8 +90,9 @@ public: } else if (false == m_cond_not_full.wait_for(lock, std::chrono::microseconds(timeout), [this]() { return m_queue.size() < m_max_num_items; })) { - std::cout << "WARNING: Thread 0x" << std::hex << std::this_thread::get_id() << std::dec << - " executing {" << typeid(*this).name() << "}.push() has failed with timeout > " << + std::thread::id currentThreadId = std::this_thread::get_id(); + std::cout << "WARNING: Thread 0x" << std::hex << currentThreadId << std::dec << + " (" << currentThreadId << ") executing {" << typeid(*this).name() << "}.push() has failed with timeout > " << (timeout * 0.001) << " ms, message: " << errorMessage << std::endl; return false; } @@ -138,9 +139,10 @@ public: } else if (false == m_cond_not_empty.wait_for(lock, std::chrono::microseconds(timeout), [this]() { return !m_queue.empty(); })) { - std::cout << "WARNING: Thread 0x" << std::hex << std::this_thread::get_id() << std::dec << - " executing {" << typeid(*this).name() << "}.pop() has failed with timeout > " << - (timeout * 0.001) << " ms, message: " << errorMessage << std::endl; + std::thread::id currentThreadId = std::this_thread::get_id(); + std::cout << "WARNING: Thread 0x" << std::hex << currentThreadId << std::dec << + " (" << currentThreadId << ") executing {" << typeid(*this).name() << "}.pop() has failed with timeout > " << + (timeout * 0.001) << " ms, message: " << errorMessage << std::endl; return false; }