Move static variables used by libraries into explicit Globals object for better thread safety.

This commit is contained in:
James Roseborough
2012-09-14 04:12:50 +00:00
parent 9f3aef6403
commit f786802bf1
30 changed files with 739 additions and 1000 deletions

View File

@@ -64,15 +64,15 @@ public class FragmentsTest extends TestSuite {
public void runFragment( Varargs expected, String script ) {
try {
String name = getName();
org.luaj.vm2.lib.jse.JsePlatform.debugGlobals();
Globals _G = org.luaj.vm2.lib.jse.JsePlatform.debugGlobals();
InputStream is = new ByteArrayInputStream(script.getBytes("UTF-8"));
LuaValue chunk ;
switch ( TEST_TYPE ) {
case TEST_TYPE_LUAJC:
chunk = LuaJC.getInstance().load(is,name,LuaValue._G);
chunk = LuaJC.getInstance().load(is,name,_G);
break;
default:
chunk = LuaC.instance.load( is, name, LuaValue._G );
chunk = LuaC.instance.load( is, name, _G );
Print.print(((LuaClosure)chunk).p);
break;
}