Sha256: 845fdedb2851e0eb3d4102069d55cc3b2d00e0ebf9d1a4ab74861c1b916ef636
Contents?: true
Size: 1.92 KB
Versions: 4
Compression:
Stored size: 1.92 KB
Contents
#pragma once #ifdef __cplusplus #include "logging/RhoLog.h" #include "common/RhoThread.h" #include "common/RhoMutexLock.h" #include "common/IRhoClassFactory.h" namespace rho { namespace common { class CThreadQueue : public common::CRhoThread { protected: static const unsigned int QUEUE_POLL_INTERVAL_SECONDS = 300; static const unsigned int QUEUE_POLL_INTERVAL_INFINITE = (unsigned int)(-1); static const unsigned int QUEUE_STARTUP_INTERVAL_SECONDS = 10; public: DEFINE_BASELOGCLASS struct IQueueCommand { virtual ~IQueueCommand(){}; virtual boolean equals(const IQueueCommand& cmd) = 0; virtual String toString() = 0; }; private: common::CAutoPtr<common::IRhoClassFactory> m_ptrFactory; int m_nPollInterval; common::CMutex m_mxStackCommands; LinkedListPtr<IQueueCommand*> m_stackCommands; boolean m_bNoThreaded; public: CThreadQueue(common::IRhoClassFactory* factory); ~CThreadQueue(void); virtual void addQueueCommand(IQueueCommand* pCmd); virtual void addQueueCommandToFront(IQueueCommand* pCmd); virtual void run(); void setPollInterval(int nInterval); int getPollInterval()const{ return m_nPollInterval;} boolean isNoThreadedMode(){ return m_bNoThreaded; } void setNonThreadedMode(boolean b){m_bNoThreaded = b;} common::IRhoClassFactory* getFactory(){ return m_ptrFactory; } protected: virtual int getLastPollInterval(){ return 0;} virtual void processCommand(IQueueCommand* pCmd) = 0; virtual boolean isSkipDuplicateCmd() { return false; } virtual void onTimeout(){} boolean isAlreadyExist(IQueueCommand *pCmd); void processCommands(); void addQueueCommandInt(IQueueCommand* pCmd); void addQueueCommandToFrontInt(IQueueCommand* pCmd); boolean isNoCommands(); }; } } #endif //__cplusplus #ifdef __cplusplus extern "C" { #endif //__cplusplus #ifdef __cplusplus }; #endif //__cplusplus
Version data entries
4 entries across 4 versions & 1 rubygems