Comments (4)
Hi,
Lua
is Send.
Unfortunately Lua the language implementation is not thread safe (therefore Lua
is not Sync
), so it is not possible to run Lua code in the same state simultaneously on different threads. However you can have a separate Lua
for each thread (or have a pool of them protected with Mutex<>
etc.) if that works for your use case.
from rlua.
Thank you for the quick reply!
(or have a pool of them protected with Mutex<> etc.)
I like the idea of this, and am a bit curious on how this would work. If I have a pool of Lua
instances, how would I know if one is already actively executing something, or if it's ready to process?
from rlua.
I like the idea of this, and am a bit curious on how this would work. If I have a pool of Lua instances, how would I know if one is already actively executing something, or if it's ready to process?
I'm afraid I don't have a ready-made solution, but it seems like something similar to r2d2 does for a database connection pool would work.
Other options might include just create a new one as needed (if the initialisation time is acceptable), keep instances in a thread local variable, etc. - at this point it's not Lua/rlua specific.
from rlua.
Alright, thank you for the information, that helps a lot! I'll see what I can work out.
from rlua.
Related Issues (20)
- Possible bug with __newindex not called on numeric indexing HOT 4
- Segfault on clone of #[repr(C)] userdata subfield HOT 9
- ios build error HOT 7
- examples for error handling HOT 2
- Example for eval return a struct? HOT 1
- Cannot load DLLs in v0.19 HOT 6
- Missing mutable borrows for Table<'lua> HOT 2
- Context.create_sequence_from should support references HOT 1
- Undefined symbol lua_checkstack HOT 8
- Crash on empty source HOT 2
- custom runtime path HOT 3
- creating a `require`-able module HOT 8
- [Request] UserData::from_lua HOT 1
- Suggestion: proc_macro for LuaUserDataMethods::add_method HOT 3
- No documentation on how to use LuaRocks with rlua HOT 3
- Rlua + Luarocks Modules -> Fail to load HOT 3
- Memory leak when using system-luajit HOT 2
- Merge with mlua HOT 32
- [Typo] Example says laoded(instead of loaded) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rlua.