PolledWait
- Parameters
-
duration real
- comment
- bug
-
Leaks handle
t
: In Jass you must set local variables that hold agents (or any child type) tonull
at the end of functions to avoid reference counter leaks. - patch
-
1.07
- Source
- Blizzard.j (suggest an edit or discuss on Github)
- return type
-
nothing
- Source code
-
function PolledWait takes real duration returns nothing local timer t local real timeRemaining if (duration > 0) then set t = CreateTimer() call TimerStart(t, duration, false, null) loop set timeRemaining = TimerGetRemaining(t) exitwhen timeRemaining <= 0 // If we have a bit of time left, skip past 10% of the remaining // duration instead of checking every interval, to minimize the // polling on long waits. if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then call TriggerSleepAction(0.1 * timeRemaining) else call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL) endif endloop call DestroyTimer(t) endif endfunction