/************************************************************************ * AUTHOR: NiuJiuRu * FILENAME: swtimer.h * CONTENT: 定时器 * NOTE: * HISTORY: * 1, [2010-09-14] created by NiuJiuRu ***********************************************************************/ #ifndef __SWTIMER_H__ #define __SWTIMER_H__ #ifdef __cplusplus extern "C" { #endif /* 定时器的节拍函数(用户回调), "wParam"指向该定时器, "lParam"暂未使用 */ typedef void (*PTimerProc)(unsigned long wParam, unsigned long lParam); /* 创建定时器(ms), 成功后默认处于暂停状态 */ void *sw_timer_create(const char *name, int period, PTimerProc proc, unsigned long wParam, unsigned long lParam); /* 销毁定时器, 超时前尝试安全的销毁, 超时后则强制销毁 */ void sw_timer_destroy(void *hTimer, int timeout); /* 暂停运行定时器 */ void sw_timer_pause(void *hTimer); /* 继续运行定时器 */ void sw_timer_resume(void *hTimer); /* 设置定时器的节拍时间(ms) */ void sw_timer_setPeriod(void *hTimer, int period); #ifdef __cplusplus } #endif #endif /* __SWTIMER_H__ */