lua-users home
lua-l archive

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



On Tuesday, August 12, 2003, at 08:45  AM, Phipps Xue wrote:

I's there any information about developing a multi-threaded c++
application, which will call lua script in each thread?

My demo programm could dance very well in single thread but crashed when
I copy the same code snippet in a programm has one main thread and one
child thread.

TIA

Xue Jianmin, Phipps

Mobile: 1350-183-1513
E-mail: xuejm@sina.com



Are you creating a new instance of the lua interpreter for each thread? From what I understand, you need to create independent instances of the interpreter. Most likely, you realize this and are doing so. however, there could be a conflict based on the snippet you have chosen. What I would recommend is to write a small snippet that really doesn't do anything except open a lua script and grab a few variable values, and then print them to stderr or wherever you wish, and fork 3 or 4 times and have it test this....once you succeed at that, you know it's not an issue with your lua calls. However, if that fails, send another post with the code attached or whatnot for the simple test and we collectively can see where there could be a problem.


-----

Michael Bernstein

"Until they become conscious they will never rebel, and until after they have rebelled they cannot become conscious"
--George Orwell, 1984