Skip to content

sco_api.run_on_game_thread

Any thread. Runs fn(ctx) on the game thread, in order, on the next tick. SCO_TOO_MANY only when 65536 tasks are already waiting (the host’s cap) or memory runs out.

sco_result (*)(sco_plugin *, sco_task_fn, void *)

Service index

Property Value
Symbol sco_api.run_on_game_thread
Record ID sco-api-run-on-game-thread
Service sco_api
Table sco_api
Version macro SCO_API_MAJOR/SCO_API_MINOR
Packed table version 65537
Since / availability size >= 32; 1.0
Complete member extent (x64 bytes) 32
Table size (x64 bytes) 128

Header source

sco_result (*run_on_game_thread)(sco_plugin* self, sco_task_fn fn, void* ctx);
Any thread. Runs fn(ctx) on the game thread, in order, on the next tick. SCO_TOO_MANY only when 65536 tasks are already waiting (the host’s cap) or memory runs out.

OK queued; BAD_ARG invalid/released self or NULL fn; TOO_MANY at queue hard cap or allocation failure; no capability gate.

unspecified

fn/ctx borrowed until execution or owner release; ctx is not copied/freed. First 256 waiting tasks use fixed ring; overflow allocates nodes up to 65,536 waiting tasks.

Any thread; reentrancy unspecified.

Runs fn(ctx) on the game thread, in order, on the next tick.

unspecified

Queued tasks dropped on unload/failed load/crash; no task-specific cancel or drop notification; caller must clean ctx.

Status labels are copied verbatim from the catalogue: direct is native access; typed-wrapper is wrapper-backed; restricted is a subset/adaptation; unsupported means no supported route is established. No status implies universal safety.

Language Catalogue status Source evidence / wrapper tokens
c direct include/sco_api.h
(*run_on_game_thread)
cpp typed-wrapper include/scosdk/plugin.hpp
const sco_result r = api_->run_on_game_thread(self_, detail::TaskTrampoline, detail::ToCtx(id));
csharp typed-wrapper sdk/csharp/Sco.Sdk/Plugin.cs
ScoResult r = a->run_on_game_thread(_self, &TaskTrampoline, (void*)id);
lua restricted plugins/lua/sco_lua.c
const sco_result r = s->api->run_on_game_thread(s->self, TaskThunk, t);
plugins/lua/sco_lua.c
if (s->ntasks >= SCO_LUA_MAX_TASKS) return PushResult(L, SCO_TOO_MANY);

schedule game thread task This is a search phrase for the existing contract, not an additional API alias.

ABI pins prove layout, not semantic behavior or a live game session.