lua-users home
lua-l archive

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


After looking more into my desire for asynchronous network communications, it appears as though a better solution might be to figure out a way to allow the users to spawn threads and use lua sockets directly.

 

Looking that the documentation for lua threading, I'm a little confused at the interaction between spawning a C thread and lua_newthread. Would doing the following be sufficient?

 

1. Implement lua_lock, lua_unlock, lua_userstateopen and lua_userstatethread to interact with OS synchronization objects - off the top of my head maybe a map<lua_State,CRITICALSECTION>.

 

2. Implement a Thread.New( threadFunc ) function in C which creates a new OS thread and in its thread function calls lua_pcall on threadFunc using the same lua_State

 

Do I need to use lua_newthread or would this be enough?

 

 

John Dunn

Senior Software Engineer

Systems Development Group

QSC Audio Products, LLC

4900 Pearl East Circle, Suite 205E

Boulder, CO 80301

303.951.3000 ext 302

john_dunn@qscaudio.com

www.qscaudio.com

 

This electronic message transmission contains information from QSC Audio Products, LLC, which may be confidential or privileged. This information is intended for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this transmission is strictly prohibited. If you have received this electronic transmission in error, please notify us immediately via telephone.