diff options
author | pixel <pixel> | 2007-05-30 22:36:31 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-05-30 22:36:31 +0000 |
commit | a0473d37f726f7bedbdeea511a6cc53744cb1ef6 (patch) | |
tree | 1810b6524f1f696081af85ed3f557c0f8ca525e7 | |
parent | d12ead8fae75e5ad38676e084317516831e6214c (diff) |
Trying to work around a spawn-Domain-from-thread issue, but doesn't really seem to fix it.
-rw-r--r-- | include/BLua.h | 5 | ||||
-rw-r--r-- | lib/BLua.cc | 11 | ||||
-rw-r--r-- | lib/LuaHttp.cc | 4 |
3 files changed, 15 insertions, 5 deletions
diff --git a/include/BLua.h b/include/BLua.h index 0894d24..eed9c2b 100644 --- a/include/BLua.h +++ b/include/BLua.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.h,v 1.36 2007-05-30 11:57:08 pixel Exp $ */ +/* $Id: BLua.h,v 1.37 2007-05-30 22:36:31 pixel Exp $ */ #ifndef __BLUA_H__ #define __BLUA_H__ @@ -128,6 +128,8 @@ class Lua : public Base { void setgcthreshold(int = 0); int getgcthreshold(); int getgccount(); + + Lua * Father(); protected: virtual Lua * spawn_from_thread(lua_State *); @@ -139,6 +141,7 @@ class Lua : public Base { static std::map<lua_State *, Lua *> lualist; bool _protected, _is_thread; void dumpvars_r(Handle *, int, int = 0) throw (GeneralException); + Lua * father; friend class LuaStatics; }; diff --git a/lib/BLua.cc b/lib/BLua.cc index d65b553..ac1f8e8 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.47 2007-05-30 11:57:09 pixel Exp $ */ +/* $Id: BLua.cc,v 1.48 2007-05-30 22:36:31 pixel Exp $ */ #include <stdlib.h> #include "BLua.h" @@ -402,6 +402,8 @@ Lua::Lua() : L(lua_open()), _protected(false), _is_thread(false) { push("BLUA_THREADS"); newtable(); settable(LUA_REGISTRYINDEX); + + father = 0; } Lua::Lua(lua_State * __L) : L(__L), _protected(false), _is_thread(true) { @@ -413,8 +415,13 @@ Lua::Lua(lua_State * __L) : L(__L), _protected(false), _is_thread(true) { } +Lua * Lua::Father() { + return father ? father : this; +} + Lua * Lua::spawn_from_thread(lua_State * __L) { - return new Lua(__L); + Lua * L = new Lua(__L); + L->father = Father(); } Lua::~Lua() { diff --git a/lib/LuaHttp.cc b/lib/LuaHttp.cc index 8f2b2e3..92af759 100644 --- a/lib/LuaHttp.cc +++ b/lib/LuaHttp.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaHttp.cc,v 1.11 2007-05-30 11:57:10 pixel Exp $ */ +/* $Id: LuaHttp.cc,v 1.12 2007-05-30 22:36:31 pixel Exp $ */ #include "Domain.h" #include "LuaHttp.h" @@ -205,7 +205,7 @@ int sLua_HttpResponse::HttpResponse_proceed(Lua * L, int n, HttpResponse * res, class LuaDomain : public Domain { public: - LuaDomain(Lua * _L, String r) : Domain(r), L(_L) { + LuaDomain(Lua * _L, String r) : Domain(r), L(_L->Father()) { id = max_id++; L->push(DOMAIN_REGISTRY); |