| 87 | } |
| 88 | |
| 89 | void NonBlockingAlgorithm::StartAlgorithm() |
| 90 | { |
| 91 | if (!ReadyToRun()) |
| 92 | return; // let algorithm check if all input/parameters are ok |
| 93 | if (m_KillRequest) |
| 94 | return; // someone wants us to die |
| 95 | |
| 96 | m_ParameterListMutex.lock(); |
| 97 | ++m_UpdateRequests; |
| 98 | m_ParameterListMutex.unlock(); |
| 99 | if (m_Thread.joinable()) // thread already running. But something obviously wants us to recalculate the output |
| 100 | { |
| 101 | return; // thread already running |
| 102 | } |
| 103 | |
| 104 | // spawn a thread that calls ThreadedUpdateFunction(), and ThreadedUpdateFinished() on us |
| 105 | this->Register(); |
| 106 | m_Thread = std::thread(StaticNonBlockingAlgorithmThread, this); |
| 107 | } |
| 108 | |
| 109 | void NonBlockingAlgorithm::StopAlgorithm() |
| 110 | { |
no test coverage detected