BLOCKING_QUEUE: display current Thread id in both hex and decimal so both worlds are happy (GDB and Visual Studio)

This commit is contained in:
vsonnier 2017-02-13 21:51:46 +01:00
parent 25f7ba386d
commit 7d412eccb6
1 changed files with 7 additions and 5 deletions

View File

@ -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;
}