|
> You'd think that read-only access to the a shared global_State fromYou'd think that, yes, but as soon as you try it you'll see there are
> different lua_State's (coroutines.create()) would be possible without a
> global interpreter lock.
problems. Consider
lua_getglobal(L,"myvar")
Is that a read-only access to L? It seems so but it may not be if "myvar"
is not in the string table. The implementation of lua_getglobal finds
"myvar" in the string table by actually adding it to the string table.
(In the current version of Lua this only ends up actually adding the var
name to the string table if the var name is longer than 40, but that is
an implementation detail.)