WoWInterface (
-   Classic - AddOn Help/Support (
-   -   Are callbacks run in parallel? (

tirafesi 09-17-19 09:30 AM

Are callbacks run in parallel?
I have an array that I modify in the OnUpdate handler. Somewhere else in the code, I call the method C_Timer.After, altering that same array after N milliseconds.

Here's my question: Will the callback run in parallel with OnUpdate, and thus risking both methods changing the array at the same time? Or does it run sequentially?

myrroddin 09-17-19 10:30 AM

Lua is a single thread language, so going without testing, I'd say sequential.

SDPhantom 09-17-19 01:34 PM

The entire Lua engine is in a single thread run by the renderer. While the coroutine library does offer thread-like functionality, it's not async. This means it blocks execution of the caller until it yields, pausing its own execution until it's called again.

All times are GMT -6. The time now is 01:28 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI