| 50 | } |
| 51 | |
| 52 | static 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 | |
| 72 | void ScriptCreateCoRoutine(asIScriptFunction *func, CScriptDictionary *arg) |
| 73 | { |
no test coverage detected