lua-users home
lua-l archive

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


Hi,

I have a Lua module(DLL) which I want to use in two different states which run in two different threads. There is a mutex to prevent access to the module by both threads simultaneously.

If I load the module in the first state, then can I load it in the second thread and use it(given that there is a mutex preventing use from both threads and therefore states, simultaneously). Could there be any issues if a module is loaded in two different states in the same application?

The reason is that there is a long running operation that involves function calls into the module. I cannot have my main(UI) thread blocked due to this. So I want to do it in a separate thread, which necessitates using a separate state due to thread safety.

After the separate thread has done its work, the module is required in the main thread. Until then, the main thread will not access the module.

Thanks,
Abhi