|
Am 02.04.2017 um 12:56 schröbte steve donovan:
No reason why shared references to _user data_ could not be allowed, although of course they need to be protected by a mutex. I like the Rust approach, where you temporally get a mutable reference and promise to give it back quickly
You would have to prevent them from being garbage-collected as well, and lua_close() is forbidden until all userdatas from a particular Lua state aren't used in other states anymore. Doable? Sure. But rather complicated.
Same goes for general tables and closures. You can get 95% right easily, but the last 5% can drive you crazy. So I'm fine with threading libraries drawing the line at primitive values (and maybe arrays/dictionaries of primitive values).
Philipp