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

📄 warshutdownengine.h

📁 ftpserver very good sample
💻 H
字号:
/** This is a generic object that contains a    repository for functions to call when a     program needs to shut down.     The different modules register themself here    if there is any particular action that must    be done when the program wanst to end, and    the registered function will be called, one    at the time, when Shutdown() is called.*/#ifndef WAR_SHUTDOWN_ENGINE_H#define WAR_SHUTDOWN_ENGINE_H/* SYSTEM INCLUDES */#ifndef WAR_LIST_INCLUDED#   define WAR_LIST_INCLUDED#   include <list>#endif/* PROJECT INCLUDES */#ifndef WAR_SHUTDOWN_ENGINE_TASK_H#   include "WarShutdownEngineTask.h"#endif#ifndef WAR_SHUTDOWN_EVENT_H#   include "WarThreadEvent.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 WarShutdownEngine{public:    typedef std::list<war_shutdown_task_ptr_t> tasklist_t;    // LIFECYCLE        /**    * Default constructor.    */    WarShutdownEngine();    ~WarShutdownEngine();    // OPERATORS        // OPERATIONS    void AddEvent(war_shutdown_task_ptr_t& taskPtr);    void AddEvent(WarShutdownProc func, war_cptr_t parg);    void DeleteEvent(war_shutdown_task_ptr_t& taskPtr);    void Shutdown();    void StartShutdown(); // Start shutdown in an independent thread    void WaitForShutdown();    // CALLBACK    // ACCESS    static WarShutdownEngine& GetEngine();    // INQUIRY    protected:private:    static WarShutdownEngine *mspEngine;    WarCriticalSection mLock;    tasklist_t mTasks;    WarThreadEvent mShutdownEvent;    bool mIsShuttingDown;    bool mHaveShutDown;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_SHUTDOWN_ENGINE_H_ */

⌨️ 快捷键说明

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