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

Method transformLuaWatchdogHook

app/src/DataModel/FrameBuilder.cpp:1933–1946  ·  view source on GitHub ↗

* @brief Lua LUA_MASKCOUNT hook that aborts runaway transforms via luaL_error() when the per-engine * deadline expires. */

Source from the content-addressed store, hash-verified

1931 * deadline expires.
1932 */
1933void DataModel::FrameBuilder::transformLuaWatchdogHook(lua_State* L, lua_Debug* ar)
1934{
1935 Q_UNUSED(ar)
1936
1937 lua_getfield(L, LUA_REGISTRYINDEX, "__ss_transform__");
1938 auto* engine = static_cast<TransformEngine*>(lua_touserdata(L, -1));
1939 lua_pop(L, 1);
1940
1941 if (!engine) [[unlikely]]
1942 return;
1943
1944 if (engine->luaDeadline.hasExpired()) [[unlikely]]
1945 luaL_error(L, "transform timed out after %d ms", kTransformWatchdogMs);
1946}
1947
1948/**
1949 * @brief Recompiles transforms + table store for a file player that bypasses ConnectionManager.

Callers

nothing calls this directly

Calls 3

lua_getfieldFunction · 0.85
lua_touserdataFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected