libUV threads in evo runtime #572
-
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? |
Beta Was this translation helpful? Give feedback.
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. |
Beta Was this translation helpful? Give feedback.
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.