Infinitegde
O.O
- Reaction score
- 86
How does concurrency work? lol
in warcraft 3*
in warcraft 3*
//! zinc
library Concurrency
{
function handlerfunc()
{
BJDebugMsg("The timer expires.");
}
function onInit()
{
timer t = CreateTimer();
BJDebugMsg("onInit runs.");
BJDebugMsg("The timer is started.");
TimerStart(t, 2.00, false, function handlerfunc);
BJDebugMsg("onInit terminates.");
}
}
//! endzinc
okay i see. So if a function is running and a timer fires off, when does warcraft 3 go to the callback of the timer? after the function is completed? or is there some special case like TriggerEvaluate or TriggerExecute or something else?
scope Test initializer Init
globals
trigger test_0 = CreateTrigger()
trigger test_1 = CreateTrigger()
endglobals
private function cond takes nothing returns boolean
call BJDebugMsg("Conditions executed...")
return false
endfunction
private function action takes nothing returns nothing
call BJDebugMsg("Actions executed...")
endfunction
private function esc takes nothing returns nothing
call BJDebugMsg("Executing...")
call TriggerExecute(test_0)
call TriggerEvaluate(test_1)
call BJDebugMsg("Finished...")
endfunction
private function Init takes nothing returns nothing
call TriggerAddAction(test_0,function action)
call TriggerAddCondition(test_1,Condition(function cond))
endfunction
endscope