lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> You'd think that read-only access to the a shared global_State from
> different lua_State's (coroutines.create()) would be possible without a
> global interpreter lock.

You'd think that, yes, but as soon as you try it you'll see there are
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.)