aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/CommandThread.hpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-04 14:40:04 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-07 10:08:27 +0000
commit88813936232bc47fc7768800c6895191585570e8 (patch)
treedfe9a615abd585ad9489afacc017ae40270486cc /src/profiling/CommandThread.hpp
parenta84edee4702c112a6e004b1987acc11144e2d6dd (diff)
downloadarmnn-88813936232bc47fc7768800c6895191585570e8.tar.gz
IVGCVSW-3937 Refactor the command thread
* Integrated the Join method into Stop * Updated the unit tests accordingly * General code refactoring Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: If8537e77b3d3ff2b780f58a07df01191a91d83d2
Diffstat (limited to 'src/profiling/CommandThread.hpp')
-rw-r--r--src/profiling/CommandThread.hpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/profiling/CommandThread.hpp b/src/profiling/CommandThread.hpp
index 6237cd2914..0456ba4372 100644
--- a/src/profiling/CommandThread.hpp
+++ b/src/profiling/CommandThread.hpp
@@ -26,19 +26,31 @@ public:
bool stopAfterTimeout,
CommandHandlerRegistry& commandHandlerRegistry,
PacketVersionResolver& packetVersionResolver,
- IProfilingConnection& socketProfilingConnection);
+ IProfilingConnection& socketProfilingConnection)
+ : m_Timeout(timeout)
+ , m_StopAfterTimeout(stopAfterTimeout)
+ , m_IsRunning(false)
+ , m_KeepRunning(false)
+ , m_CommandThread()
+ , m_CommandHandlerRegistry(commandHandlerRegistry)
+ , m_PacketVersionResolver(packetVersionResolver)
+ , m_SocketProfilingConnection(socketProfilingConnection)
+ {}
+ ~CommandThread() { Stop(); }
void Start();
void Stop();
- void Join();
+
bool IsRunning() const;
- bool StopAfterTimeout(bool StopAfterTimeout);
+
+ void SetTimeout(uint32_t timeout);
+ void SetStopAfterTimeout(bool stopAfterTimeout);
private:
void WaitForPacket();
- uint32_t m_Timeout;
- bool m_StopAfterTimeout;
+ std::atomic<uint32_t> m_Timeout;
+ std::atomic<bool> m_StopAfterTimeout;
std::atomic<bool> m_IsRunning;
std::atomic<bool> m_KeepRunning;
std::thread m_CommandThread;
@@ -48,6 +60,6 @@ private:
IProfilingConnection& m_SocketProfilingConnection;
};
-}//namespace profiling
+} // namespace profiling
-}//namespace armnn \ No newline at end of file
+} // namespace armnn