warthreadengine.cpp

来自「ftpserver very good sample」· C++ 代码 · 共 67 行

CPP
67
字号
#include "StdAfx.h"#include "WarThreadEngine.h"   // class implemented#ifndef WAR_AUTO_LOCK_H#   include "WarAutoLock.h"#endif#define AUTO_LOCK WarAutoLock my_lock(mLock)/////////////////////////////// PUBLIC ///////////////////////////////////////WarThreadEngine *WarThreadEngine::mspThis;//============================= LIFECYCLE ====================================WarThreadEngine::WarThreadEngine(){    if (NULL == mspThis)        mspThis = this;}// WarThreadEngineWarThreadEngine::~WarThreadEngine(){    if (this == mspThis)        mspThis = NULL;}// ~WarThreadEngine//============================= OPERATORS ====================================//============================= OPERATIONS ===================================void WarThreadEngine::SetPriOnAllThreads(const WarPrioritiesDefE newPriority){    AUTO_LOCK;    for(thread_set_t::iterator P = mThreads.begin()        ; P != mThreads.end()        ; ++P)    {        (*P)->SetPriority(newPriority);    }}//============================= CALLBACK   ===================================//============================= ACCESS     ===================================//============================= INQUIRY    ===================================/////////////////////////////// PROTECTED  ///////////////////////////////////void WarThreadEngine::AddThread(WarThread *pThread){    AUTO_LOCK;    mThreads.insert(war_thread_ptr_t(pThread));}void WarThreadEngine::RemoveThread(WarThread *pThread){    AUTO_LOCK;    thread_set_t::iterator P = mThreads.find(war_thread_ptr_t(pThread));    if (P != mThreads.end())        mThreads.erase(P);}/////////////////////////////// PRIVATE    ///////////////////////////////////

⌨️ 快捷键说明

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