[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Thread question
- From: Diman Todorov <diman@...>
- Date: Tue, 18 Jul 2006 09:17:02 +0200
On Jul 18, 2006, at 3:03 AM, D Burgess wrote:
Thanks Wim, I have (re)read the list messages and Wiki on this
subject.
Having created my thread specific global table and __index
metatabled it
to the mainthread global table, is the best way to handle the base
functions
next(), pairs() etc to simply reexecute base_open() (lbaselib.c) on
the new
thread object or is it better to "copy" the baselib functions from
the main
lua state to the new lua thread?
I am having the very same problem at the moment.
My experience so far is that threads do share the same global namespace.
On the 10th of July I posted a question regarding a problem I had
because
of this very quirk.
David, I don't think you can "copy" the baselib functions to the lua
threads.
Except if you modify the lua runtime that is. I am currently setting the
global-global table to a variable in the thread-global table and using
standard lib functions with env.pairs env.next etc. I am not very happy
with this solution though. Another idea I have is to look at how object
inheritance works in lua and maybe do something similar but I haven't
come around to that yet. Using base_open on every thread is not an
option
for me as I create and execute tens of thousands of threads in my
application.
I would certainly follow this thread closely ;)
cheers
Diman