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

📄 wartimer.h

📁 ftpserver very good sample
💻 H
字号:
/** */#ifndef WAR_TIMER_H#define WAR_TIMER_H/* SYSTEM INCLUDES */#ifndef WAR_INCLUDED_SET#   define WAR_INCLUDED_SET#   include <set>#endif#ifndef WAR_ASSERT_H_INCLUDED#   define WAR_ASSERT_H_INCLUDED#   include <assert.h>#endif/* PROJECT INCLUDES */#ifndef WAR_TIMER_EVENT_H#   include "WarTimerEvent.h"#endif#ifndef WAR_THREAD_H#   include "WarThread.h"#endif#ifndef WAR_THREAD_POOL_H#   include "WarThreadPool.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarTimer : public WarThread{public:    typedef std::multiset<war_timer_event_ptr_t> events_t;    // LIFECYCLE        /**    * Default constructor.    */    WarTimer();        /**    * Destructor.    */    ~WarTimer();        // OPERATORS    // OPERATIONS                               void AddEvent(war_timer_event_ptr_t& newEvent)        throw(WarException);        void KillEvent(war_timer_event_ptr_t& oldEvent)        throw(WarException);        virtual void SetExitFlag();    virtual void SetAbortFlag()    {        assert(false); // Use SetExitFlag()    }        // ACCESS    const WarTime GetNextEventTime();    static WarTimer& GetTimer() throw(WarException);    static bool IsTimerActive()    {        return spThis != NULL;    }    // INQUIRY    protected:        void Run();    friend class WarTimerEventTask;    // Called by WarTimer and WarTimerEventTask    void OnCompleted(war_timer_event_ptr_t& my_event);    friend class WarShutdownEngine;    static void OnShutdown(war_cptr_t ptr);private:    events_t mEvents;    WarCriticalSection mLock;    WarThreadEvent mSignal;    WarThreadPool mPool;    static WarTimer *spThis;};/* INLINE METHODS *//* EXTERNAL REFERENCES */typedef WarPtrWrapper<WarTimer> war_timer_ptr_t;#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_TIMER_H_ */

⌨️ 快捷键说明

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