MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / start

Method start

common/script/scriptrunner.cpp:38–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38bool ScriptRunner::start(std::string scriptPath, std::string displayName, std::string titleIdHex)
39{
40 if (mState.load() != State::Idle) {
41 return false;
42 }
43
44 mPath = std::move(scriptPath);
45 mName = std::move(displayName);
46 mTitleIdHex = std::move(titleIdHex);
47 mBridge.reset();
48 ScriptConsole::get().reset();
49 ckpt_script_abort_reset();
50
51 // Breadcrumb the start on the main thread: if the worker faults mid-run the
52 // "exited with" line from ScriptEngine::run never appears, so this line being
53 // the last script trace pins the crash to this script's execution.
54 Logging::info("[script] starting '{}' ({}), title {}", mName, mPath, mTitleIdHex.empty() ? "<none>" : mTitleIdHex);
55
56 mState.store(State::Running);
57 if (!Threads::create(std::optional<size_t>(THREAD_STACK), ScriptRunner::runThread)) {
58 mState.store(State::Idle);
59 Logging::error("[script] worker thread creation failed for '{}'", mName);
60 return false;
61 }
62 return true;
63}
64
65void ScriptRunner::runThread(void)
66{

Callers

nothing calls this directly

Calls 9

getFunction · 0.85
ckpt_script_abort_resetFunction · 0.85
storeMethod · 0.80
infoFunction · 0.50
createFunction · 0.50
errorFunction · 0.50
loadMethod · 0.45
resetMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected