lua-users home
lua-l archive

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


Hello,
This question probably has came up before, and did my best reading the archives
and the documentation... but I was not able to come up with an understanding.

Most messages seem to talk about the lua threads and corutines.

But I am trying to determine if LUA would be simply suited for the
following

I have a C++ process that runs with 10 threads (instanciated right
when the process comes up).  Then from those threads I execute
independently the same C++ function.  This function gets called
about 100 times a second (on a multi CPU machine).  It shares no data
with other threads.  

What I would like is to allow this function to call LUA, and pass
in a name of a lua script that would manipulate the a simple C structure
with about 160 fields (characters and ints). By manipulate I mean
it will just need to compare several values and then set one field to either 1 or 2 or 3.


I think what I need to
is to create a LUA context when each thread starts up with lua_open

then somehow, precompile the LUA script (perhaps for each context)


the start running the threads, to call LUA
then somehow pass the pointer to the precompiled binary
to lua_dofile (or a similar function, but I could not figure out
yet which one can take a bytecompiled), and the state L for
that given thread

Right now I just wanted to evaluate if the above would work functionaly,
then I plan to run some performance tests to see by how much the performance of my application would degrade (I hope not by much,
because I do not plan to allocate/deallocate any memory)

So I wanted to ask if the above model is workable

Thanks in advance,
Vlad


__________________________________________________________________
Introducing the New Netscape Internet Service. 
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need. 

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp