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

Method start

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

Source from the content-addressed store, hash-verified

123}
124
125bool GpsDevice::start() {
126 auto lock = mutex.asScopedLock();
127 lock.lock();
128
129 if (thread != nullptr && thread->getState() != Thread::State::Stopped) {
130 LOGGER.warn("Already started");
131 return true;
132 }
133
134 threadInterrupted = false;
135
136 LOGGER.info("Starting thread");
137 setState(State::PendingOn);
138
139 thread = std::make_unique<Thread>(
140 "gps",
141 4096,
142 [this]() {
143 return this->threadMain();
144 }
145 );
146 thread->setPriority(tt::Thread::Priority::High);
147 thread->start();
148
149 LOGGER.info("Starting finished");
150 return true;
151}
152
153bool GpsDevice::stop() {
154 auto lock = mutex.asScopedLock();

Callers 15

test_case_startMethod · 0.45
test_case_reenterMethod · 0.45
runMethod · 0.45
ThreadTest.cppFile · 0.45
MutexTest.cppFile · 0.45
TimerTest.cppFile · 0.45
api_connectFunction · 0.45
module_startFunction · 0.45
bluetooth_midi_startFunction · 0.45

Calls 7

threadMainMethod · 0.95
asScopedLockMethod · 0.80
warnMethod · 0.80
infoMethod · 0.80
setPriorityMethod · 0.80
lockMethod · 0.45
getStateMethod · 0.45

Tested by 3

test_case_startMethod · 0.36
test_case_reenterMethod · 0.36
runMethod · 0.36