From 673f38246ac3548caefec41183e3dd7477d9f6f6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 13 Sep 2022 23:50:12 +0200 Subject: treewide: separate Lua runtime resources Move classes required for Lua runtime support into a new `luci-lua-runtime` package. Also replace the `luci.http` and `luci.util` classes in `luci-lib-base` with stubbed versions interacting with the ucode based runtime environment. Finally merge `luci-base-ucode` into the remainders of `luci-base`. Signed-off-by: Jo-Philipp Wich --- libs/luci-lib-base/luasrc/util.lua | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'libs/luci-lib-base/luasrc/util.lua') diff --git a/libs/luci-lib-base/luasrc/util.lua b/libs/luci-lib-base/luasrc/util.lua index 89757917ff..80013179aa 100644 --- a/libs/luci-lib-base/luasrc/util.lua +++ b/libs/luci-lib-base/luasrc/util.lua @@ -100,32 +100,8 @@ end -- Scope manipulation routines -- -coxpt = setmetatable({}, { __mode = "kv" }) - -local tl_meta = { - __mode = "k", - - __index = function(self, key) - local t = rawget(self, coxpt[coroutine.running()] - or coroutine.running() or 0) - return t and t[key] - end, - - __newindex = function(self, key, value) - local c = coxpt[coroutine.running()] or coroutine.running() or 0 - local r = rawget(self, c) - if not r then - rawset(self, c, { [key] = value }) - else - r[key] = value - end - end -} - --- the current active coroutine. A thread local store is private a table object --- whose values can't be accessed from outside of the running coroutine. function threadlocal(tbl) - return setmetatable(tbl or {}, tl_meta) + return tbl or {} end @@ -772,7 +748,6 @@ function coxpcall(f, err, ...) co = coroutine.create(newf) end coromap[co] = current - coxpt[co] = coxpt[current] or current or 0 return performResume(err, co, ...) end end -- cgit v1.2.3