You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
3 years ago
|
#if 0
|
||
|
//--------------------------------------------//
|
||
|
// 本文件为自动生成,请勿编辑 //
|
||
|
// thanks to 最萌小汐 //
|
||
|
//--------------------------------------------//
|
||
|
#endif
|
||
|
#ifdef USE_BJ_ANTI_LEAK
|
||
|
#ifndef YDWEPolledWaitNullIncluded
|
||
|
#define YDWEPolledWaitNullIncluded
|
||
|
|
||
|
|
||
|
library YDWEPolledWaitNull
|
||
|
|
||
|
function YDWEPolledWaitNull 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
|
||
|
set t = null
|
||
|
endfunction
|
||
|
|
||
|
endlibrary
|
||
|
|
||
|
#endif
|
||
|
#endif
|