1
0
forked from mirrors/0ad

Encapsulate runtime creation.

- Makes it easier to change down the line (and change is coming)
- Allows making g_ScriptRuntime thread-local easily.
- Remove ParentRuntime, which is not used at the moment.

Part of the SM52 migration, stage: SM45 compatible.

Patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3087
This was SVN commit r24171.
This commit is contained in:
wraitii
2020-11-12 09:34:40 +00:00
parent 90367cdc53
commit 66cc595c53
10 changed files with 46 additions and 49 deletions
+2 -1
View File
@@ -388,7 +388,8 @@ void CNetServerWorker::Run()
// To avoid the need for JS_SetContextThread, we create and use and destroy
// the script interface entirely within this network thread
m_ScriptInterface = new ScriptInterface("Engine", "Net server", ScriptInterface::CreateRuntime(g_ScriptRuntime));
shared_ptr<ScriptRuntime> netServerRuntime = ScriptRuntime::CreateRuntime();
m_ScriptInterface = new ScriptInterface("Engine", "Net server", netServerRuntime);
m_GameAttributes.init(m_ScriptInterface->GetJSRuntime(), JS::UndefinedValue());
while (true)