MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / delay

Method delay

app/src/DataModel/Scripting/ControlScriptWorker.cpp:299–311  ·  view source on GitHub ↗

* @brief Blocks the worker thread for the given time (capped at one hour), sleeping in slices * so shutdown can interrupt the wait, then defers the watchdog deadline. */

Source from the content-addressed store, hash-verified

297 * so shutdown can interrupt the wait, then defers the watchdog deadline.
298 */
299void DataModel::ControlApiBridge::delay(int milliseconds)
300{
301 const int total = qBound(0, milliseconds, kMaxDelayMs);
302 for (int slept = 0; slept < total; slept += kDelaySliceMs) {
303 if (s_shutdownRequested.load(std::memory_order_acquire))
304 return;
305
306 QThread::msleep(static_cast<unsigned long>(qMin(kDelaySliceMs, total - slept)));
307 }
308
309 if (m_watchdog)
310 m_watchdog->arm();
311}
312
313//--------------------------------------------------------------------------------------------------
314// Construction

Callers 3

jquery.jsFile · 0.80
showTipFunction · 0.80
delayFunction · 0.80

Calls 2

loadMethod · 0.45
armMethod · 0.45

Tested by

no test coverage detected