libUV threads in evo runtime #572
Answered
by
rdw-software
Jabadahut50
asked this question in
Q&A
|
Evo's documentation notes that it is strictly single threaded but it provides access to the LibUV library which includes multi threading? Am I misunderstanding how LibUV Threads work? Or am I to understand that Evo's runtime itself is inherently single threaded but whatever you write that uses it might not be if they use LibUV threads? |
Answered by
rdw-software
Oct 17, 2024
Replies: 1 comment 2 replies
|
You're correct. The runtime is inherently single-threaded, meaning your Lua code runs on one thread. Despite that fact, libuv can absolutely make use of multiple threads, so scripts can offload certain tasks like I/O, timers, or other work when needed. Note that newly-spawned threads don't share the same Lua state and therefore don't have access to the main thread's global environment. |
2 replies
Answer selected by
Jabadahut50
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're correct. The runtime is inherently single-threaded, meaning your Lua code runs on one thread. Despite that fact, libuv can absolutely make use of multiple threads, so scripts can offload certain tasks like I/O, timers, or other work when needed. Note that newly-spawned threads don't share the same Lua state and therefore don't have access to the main thread's global environment.