mlua-rs/rlua

You can't send rlua::Thread handles to other threads, you can't send any rlua handle types to other threads, the only thing you can send to other threads is the entire Lua state when there are no outstanding handles.

Closed this issue · 0 comments

You can't send rlua::Thread handles to other threads, you can't send any rlua handle types to other threads, the only thing you can send to other threads is the entire Lua state when there are no outstanding handles.

Lua is not thread safe at all, if this were allowed this would be very unsound. Lua threads cannot be run on different OS threads, you need to have one Lua state per real OS thread.

tokio::spawn has a Send bound because it may be executing futures on multiple threads, so you can't send it references to things that are not Sync, and nothing about Lua is Sync

Originally posted by @kyren in #119 (comment)