⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ctimer.h

📁 简单的linux下的timer类
💻 H
字号:

#ifndef __CTIMER_H__
#define __CTIMER_H__


#ifdef __cplusplus
extern "C"{
#endif

typedef void (*pfTimerCallFunc)(int);

typedef struct tagTimer {    
    int total_time;   
    int left_time;   
    pfTimerCallFunc pfFunc;        
    struct tagTimer *pNextNode;
}TIMER_S;    

/* 本类只能精确到秒级 */
class Timer
{
    public:
        Timer();
        ~Timer();
        int SetTimer(int iSec,pfTimerCallFunc pfFunc);
        void Start();
        void ReStart();
        void Stop();
        void Clear();

    private:
        static void HandlNode(TIMER_S *Node, int iFlag);
        static void Catch_Alarm(int iSig);
        static int SetFlag();
        //static void *Trigger(void*p);
        
        static int _iFlag;
        static TIMER_S *_pTimeListHead;
        
        
        TIMER_S *_pTimerNodeAddr;
};



#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -