| 30 | } |
| 31 | |
| 32 | bool Test() |
| 33 | { |
| 34 | bool fail = false; |
| 35 | |
| 36 | engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); |
| 37 | |
| 38 | COutStream out; |
| 39 | engine->SetMessageCallback(asMETHOD(COutStream,Callback),&out,asCALL_THISCALL); |
| 40 | |
| 41 | asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); |
| 42 | mod->AddScriptSection(TESTNAME, script, strlen(script), 0); |
| 43 | mod->Build(); |
| 44 | |
| 45 | // Get a function declaration, this should be the same after the other thread terminates |
| 46 | asIScriptFunction *func = mod->GetFunctionByIndex(0); |
| 47 | const char *str = func->GetDeclaration(); |
| 48 | |
| 49 | // Create the second thread that in turn will get the declaration of another function |
| 50 | HANDLE threadId = (HANDLE)_beginthread(Thread, 0, 0); |
| 51 | |
| 52 | // Make sure the other thread completes execution |
| 53 | WaitForSingleObject(threadId, INFINITE); |
| 54 | |
| 55 | // Verify that the string we retrieved before is still the same |
| 56 | if( strcmp(str, "void TestSharedString1()") != 0 ) |
| 57 | { |
| 58 | printf("%s: Shared strings don't work as they should\n", TESTNAME); |
| 59 | fail = true; |
| 60 | } |
| 61 | |
| 62 | engine->Release(); |
| 63 | |
| 64 | // Success |
| 65 | return fail; |
| 66 | } |
| 67 | |
| 68 | } // namespace |
| 69 |
nothing calls this directly
no test coverage detected