Question in topic...
Got some strange things going on which look as threading issues...
Question in topic...
Got some strange things going on which look as threading issues...
Are you seriously asking this? No.. really.... seriously?
What's so weird about this question?
AFAIK macros and text gets executed in the main thread.
Try typing this ingame:
That will freeze WoW for a really long time - but why would Blizzard allow addons to freeze WoW's main thread?Code:/run for i=0,10000000 do for t=0,1000000 do end end
@OP: I believe they do. Apoc posted a thread about hooking the OnUpdate script event for addons, which is basicly like an EndScene hook - it should be called from the main thread.
[16:15:41] Cypher: caus the CPU is a dick
[16:16:07] kynox: CPU is mad
[16:16:15] Cypher: CPU is all like
[16:16:16] Cypher: whatever, i do what i want
I dont realize it is such a stupid question.
I dont know if LUA parsers are threaded, if all LUA addons are executed side by side or one at a time, stuff like that ...
I would say without knowing anything about it, that that the main thread probably fires the frame update event syncronously, but i dont know for sure, hence asking.
@Main, thanks i have looked but i didnt find that info. I tried to do stuff like that. Call a custom lua command from an addon instead of endscene hook (or actually both during development) but some strange things happened, thats why I Just wanted to make sure the the Addon was executing in the main thread...
@MaiN: It makes sense for for loops to pause the main thread until completion, otherwise people could use them as a crude timing method for macro based bots.
Think I can answer this one myself... and the answer is... No...
(Or maybe No... really... seriously... ;P)
GetCurrentThreadId returns different ids when called from Lua addon and from endscene hook.
Lua is not Multi-Threaded capable, at least not in it's current incarnation. Lua must be called from the Main Thread of the game.
So... How come I got the result I got from my little test?
1. Reg you Lua function which just call GetCurrentThreadId(), call that func from Lua addon
2. Call GetCurrentTreadId() from endscene
3. Compare, at least I get diffent ids...
Another reason it has to be executed by WoWs mainthread is that all relevant game-information is stored in the mainthreads TLS.
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
"I cried a little earlier when I had to poop" - Sku
@robske, Ok thanks, must be something strange that messed up my test.
And thanks to all other too taking time. Thought about the TLS but was confused by my test, which must have been f****d up.