Closed daurnimator closed 6 years ago
your code here is completely wrong. loop_start starts a new thread. you then do not keep trying to call loop_read/write/misc yourself. the callback is called from the loop thread yes, this is well explained in the mosquitto reference
your code here is completely wrong. loop_start starts a new thread. you then do not keep trying to call loop_read/write/misc yourself. the callback is called from the loop thread yes, this is well explained in the mosquitto reference
Ah oops. I misread what :loop_start
was for. Looks like I just call :loop_read
/write/misc as required.
So it appears that :loop_start
is always unsafe to use in the style that lua-mosquitto binds it.
Could you remove it from the API?
You're perfectly free to implement your own locking and access controls, and there are totally uses where you don't need anything shared, where having it called from other threads is completely ok. I don't see any reason to just go and flat remove the binding, that seems overreaching.
When in async mode, callbacks seem to be called when mosquitto feels like it, which is entirely undefined behaviour.