IVGCVSW-3984 Fix CheckPeriodicCounterCaptureThread
* PerodicCounterCapture now sleeps instead of terminating
when reading empty counter data
* m_IsRunning is now set to false after the thread is joined and
is no longer atomic
* removed usages of find() (not thread safe)
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: Ie65d5a9a7e42a31653ec8eed064849355661ef56
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
index db09856..3df0f22 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
@@ -109,8 +109,16 @@
// Notify the Send Thread that new data is available in the Counter Stream Buffer
m_SendCounterPacket.SetReadyToRead();
- // Start the Period Counter Capture thread (if not running already)
- m_PeriodicCounterCapture.Start();
+ if (capturePeriod == 0 || validCounterIds.empty())
+ {
+ // No data capture stop the thread
+ m_PeriodicCounterCapture.Stop();
+ }
+ else
+ {
+ // Start the Period Counter Capture thread (if not running already)
+ m_PeriodicCounterCapture.Start();
+ }
break;
}