From 2ba48d251d0fe4dca214497ac33283106ca0973b Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Fri, 29 Nov 2019 09:10:59 +0000 Subject: IVGCVSW-4118 Fix long unit test execution * Reduced sleep_for timings * Removed duplicate SendStreamMetaDataPacket. * Modified SendCounterPacket::WaitForPacketSent to use wait_for * Modified SendCounterPacket::Send WaitingForAck to use wait_for * Added destructor to StreamRedirector. * Added method SendCounterPacketTests::HasWrittenData * Restructured many tests in ProfilingTests. Signed-off-by: Keith Davis Change-Id: I55c59cac6674ac40a1056a5302a997d5da9e9d91 Signed-off-by: Colm Donelan --- src/profiling/SendCounterPacket.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/profiling/SendCounterPacket.hpp') diff --git a/src/profiling/SendCounterPacket.hpp b/src/profiling/SendCounterPacket.hpp index 102cbccc84..42e84323e4 100644 --- a/src/profiling/SendCounterPacket.hpp +++ b/src/profiling/SendCounterPacket.hpp @@ -64,12 +64,11 @@ public: void Stop(bool rethrowSendThreadExceptions = true); bool IsRunning() { return m_IsRunning.load(); } - void WaitForPacketSent() + void WaitForPacketSent(uint32_t timeout = 1000) { std::unique_lock lock(m_PacketSentWaitMutex); - - // Blocks until notified that at least a packet has been sent - m_PacketSentWaitCondition.wait(lock); + // Blocks until notified that at least a packet has been sent or until timeout expires. + m_PacketSentWaitCondition.wait_for(lock, std::chrono::milliseconds(timeout)); } private: -- cgit v1.2.1