MCPcopy Create free account
hub / github.com/anjo76/angelscript / ScriptYield

Function ScriptYield

sdk/add_on/contextmgr/contextmgr.cpp:52–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52static void ScriptYield()
53{
54 // Get a pointer to the context that is currently being executed
55 asIScriptContext *ctx = asGetActiveContext();
56 if( ctx )
57 {
58 // Get the context manager from the user data
59 CContextMgr *ctxMgr = reinterpret_cast<CContextMgr*>(ctx->GetUserData(CONTEXT_MGR));
60 if( ctxMgr )
61 {
62 // Let the context manager know that it should run the next co-routine
63 ctxMgr->NextCoRoutine();
64
65 // The current context must be suspended so that VM will return from
66 // the Execute() method where the context manager will continue.
67 ctx->Suspend();
68 }
69 }
70}
71
72void ScriptCreateCoRoutine(asIScriptFunction *func, CScriptDictionary *arg)
73{

Callers 1

ScriptYield_genericFunction · 0.85

Calls 3

NextCoRoutineMethod · 0.80
SuspendMethod · 0.80
GetUserDataMethod · 0.45

Tested by

no test coverage detected