Quantcast Are callbacks run in parallel? - WoWInterface
Thread Tools Display Modes
09-17-19, 09:30 AM   #1
tirafesi
A Murloc Raider
Join Date: Sep 2019
Posts: 8
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?
  Reply With Quote
09-17-19, 10:30 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,051
Lua is a single thread language, so going without testing, I'd say sequential.
  Reply With Quote
09-17-19, 01:34 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,843
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.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Classic - AddOns, Compliations, Macros » Classic - AddOn Help/Support » Are callbacks run in parallel?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off