feat(timer): add LCUITimer_SetTimeout() and LCUITimer_SetInterval()

This commit is contained in:
Liu Chao
2018-02-20 18:23:24 +08:00
parent ef66d4f6be
commit f032f6ffda
2 changed files with 24 additions and 0 deletions
+10
View File
@@ -49,6 +49,16 @@ LCUI_BEGIN_HEADER
LCUI_API int LCUITimer_Set( long int n_ms, void (*callback_func)(void*),
void *arg, LCUI_BOOL reuse );
/** repeatedly calls a function, with a fixed time delay between each call. */
LCUI_API int LCUITimer_SetTimeout( long int n_ms,
void( *callback )(void*),
void *arg );
/** set a timer which execute a function once after the timer expires. */
LCUI_API int LCUITimer_SetInterval( long int n_ms,
void( *callback )(void*),
void *arg );
/**
* 释放定时器
* 当不需要定时器时,可以使用该函数释放定时器占用的资源,并移除程序任务队列
+14
View File
@@ -200,6 +200,20 @@ int LCUITimer_Set( long int n_ms, void (*func)(void*),
return timer->id;
}
int LCUITimer_SetTimeout( long int n_ms,
void( *callback )(void*),
void *arg )
{
return LCUITimer_Set( n_ms, callback, arg, FALSE );
}
int LCUITimer_SetInterval( long int n_ms,
void( *callback )(void*),
void *arg )
{
return LCUITimer_Set( n_ms, callback, arg, TRUE );
}
int LCUITimer_Free( int timer_id )
{
Timer timer;