lua-users home
lua-l archive

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


Hello,

I'm working on a C application, https://github.com/destroyedlolo/Selene
 , which is receiving some MQTT data. Those data are handled by a seperate thread.

This application uses Lua scripts for customisation purposes, which can be launched from both the main thread, or the receiving one.

As I know it is not possible to have shared access on Lua's context, I surrounded pcall()s by exclusive mutex ... but unfortunately, my application is crashing after a while and pcall return some corrupted lua code :

*E* (ToDo) ./Selenite/Design.lua:20: attempt to call method '' (a nil value)
*E* (ToDo) ./Selenite/Design.lua:20: attempt to call method '' (a nil value)
*E* (ToDo) [string "./Selenite/Design.lua"]:40: attempt to call field '��' (a nil value)
*E* (ToDo) ./Selenite/Design.lua:20: attempt to call method �0h�0' (a nil value)
*E* (ToDo) ./Selenite/Design.lua:20: attempt to call method �0h�0' (a nil value)

Is it safe to 2 different threads accessing the same Lua's context if they can't do it at the same time ?

Thanks

Laurent