WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Classic - AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=179)
-   -   Are callbacks run in parallel? (https://www.wowinterface.com/forums/showthread.php?t=57509)

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 08:22 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI