MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / stop

Method stop

Tactility/Source/hal/gps/GpsDevice.cpp:153–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153bool GpsDevice::stop() {
154 auto lock = mutex.asScopedLock();
155 lock.lock();
156
157 setState(State::PendingOff);
158
159 if (thread != nullptr) {
160 threadInterrupted = true;
161
162 // Detach thread, it will auto-delete when leaving the current scope
163 auto old_thread = std::move(thread);
164
165 if (old_thread->getState() != Thread::State::Stopped) {
166 // Unlock so thread can lock
167 lock.unlock();
168 // Wait for thread to finish
169 old_thread->join();
170 // Re-lock to continue logic below
171 lock.lock();
172 }
173 }
174
175 setState(State::Off);
176
177 return true;
178}
179
180bool GpsDevice::isThreadInterrupted() const {
181 auto lock = mutex.asScopedLock();

Callers 15

TimerTest.cppFile · 0.45
api_disconnectFunction · 0.45
module_stopFunction · 0.45
bluetooth_midi_stopFunction · 0.45
bluetooth_serial_stopFunction · 0.45
onStopMethod · 0.45
~ScreenshotAppMethod · 0.45
onStartPressedMethod · 0.45
onShowMethod · 0.45
onHideMethod · 0.45

Calls 5

asScopedLockMethod · 0.80
joinMethod · 0.80
lockMethod · 0.45
getStateMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected