int main(int argc, char *argv[]) { TimerThread *timer; timer = timer_thread_create(1, 1, handle_alarm); timer_thread_start(timer); printf("Timer status: %s\n", get_timer_status_str(get_timer_status(timer))); while (count != 20) usleep(10); printf("Requesting timer stop\n"); timer_thread_stop(timer); printf("Timer status: %s\n", get_timer_status_string(get_timer_status(timer))); timer_thread_destroy(timer); return 0; }
/* 初始化定时器模块 */ LCUI_API void LCUIModule_Timer_Init( void ) { LCUI_StartTicks(); LCUISleeper_Create( &timer_sleeper ); timer_thread_start( &LCUI_Sys.timer_thread, &global_timer_list ); }