lua-users home
lua-l archive

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


Hi,

I've just multithreaded our game engine, and I'm currently trying to
remove lock and dependencies. I've used lua_lock and lua_unlock. They
are doing a pretty good job, but my architecture cause a lot of stalls.

My script system is composed of a main thread that contains all binding
to C++ object ( which is quite huge memory usage ). All other thread are
child of the first one, with a private global table that __index to the
main thread's one. The main thread is read-only ( ensure by the
definition of __newindex to an error function ).

Each child thread are only being run in a single OS thread. I know that
string hash table and garbage collector object list is maintained in the
main thread.

I would like to limit the lock when no access is made to the main
thread, as child thread are only access singlethreaded. Do you think it
is possible to create a lua_mainlock() that lock the main thread when we
access it?? ( method where G(L) is used instead of L ).

If yes, what would be the size of the change in the lua code base??

If not, I have no other solution that keep the binding data in C++ and
use another mechanism to implement C++ function call in lua

Thanks

-- 
--
Julien Hamaide
Technical Director
10Tacle Studios Belgium / Elsewhere Entertainment