| 52 | } |
| 53 | |
| 54 | void SendThread::Start(IProfilingConnection& profilingConnection) |
| 55 | { |
| 56 | // Check if the send thread is already running |
| 57 | if (m_IsRunning.load()) |
| 58 | { |
| 59 | // The send thread is already running |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | #if !defined(ARMNN_DISABLE_THREADS) |
| 64 | if (m_SendThread.joinable()) |
| 65 | { |
| 66 | m_SendThread.join(); |
| 67 | } |
| 68 | #endif |
| 69 | |
| 70 | // Mark the send thread as running |
| 71 | m_IsRunning.store(true); |
| 72 | |
| 73 | // Keep the send procedure going until the send thread is signalled to stop |
| 74 | m_KeepRunning.store(true); |
| 75 | |
| 76 | // Make sure the send thread will not flush the buffer until signaled to do so |
| 77 | // no need for a mutex as the send thread can not be running at this point |
| 78 | m_ReadyToRead = false; |
| 79 | |
| 80 | m_PacketSent = false; |
| 81 | |
| 82 | // Start the send thread |
| 83 | #if !defined(ARMNN_DISABLE_THREADS) |
| 84 | m_SendThread = std::thread(&SendThread::Send, this, std::ref(profilingConnection)); |
| 85 | #else |
| 86 | IgnoreUnused(profilingConnection); |
| 87 | #endif |
| 88 | } |
| 89 | |
| 90 | void SendThread::Stop(bool rethrowSendThreadExceptions) |
| 91 | { |
no test coverage detected