mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
feat(timer): add LCUITimer_SetTimeout() and LCUITimer_SetInterval()
This commit is contained in:
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user