| 65 | } |
| 66 | |
| 67 | void Thread::stopThread() { |
| 68 | if (_state == State::Unknown) { |
| 69 | return; |
| 70 | } |
| 71 | _state = State::Stopping; |
| 72 | size_t timeout = 0u; |
| 73 | while (_state != State::Stopped) { |
| 74 | std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
| 75 | ++timeout; |
| 76 | if (timeout > 50u) { |
| 77 | cancelThread(); |
| 78 | SI_LOG_DEBUG("%s: Thread did not stop within timeout? !!TIMEOUT!!", _name.c_str()); |
| 79 | break; |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | void Thread::pauseThread() { |
| 85 | _state = State::Pausing; |
nothing calls this directly
no outgoing calls
no test coverage detected