Main Page   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

bogotel::CTimer Class Reference

#include <Timer.h>


Public Member Functions

 CTimer (int period=100)
virtual ~CTimer ()
void run ()
void add (long lDelay, CTimerTarget *pTarget, int timerType=0, int stateId=0)
int registerTarget (CTimerTarget *pTarget)
void requestTargetDeletion (CTimerTarget *pTarget)

Static Public Member Functions

void do_thread (void *param)

Private Member Functions

void checkForExpirations ()
void handleDefunctTargets ()
bool targetIsActive (long lTargetId)

Private Attributes

boost::thread * m_pThrd
boost::mutex m_mtxTimerInfoList
boost::mutex m_mtxActiveTimerSet
boost::mutex m_mtxDefunctVec
boost::mutex m_mtxStop
boost::condition m_condStop
bool m_bStop
int m_period
LST_TIMER m_lstTimer
SET_LONG m_setActive
VEC_TIMERTARGET m_vecDefunct


Constructor & Destructor Documentation

bogotel::CTimer::CTimer int  period = 100  ) 
 

Parameters:
period Interval to check for expired timer (in milliseconds)

Definition at line 26 of file Timer.cpp.

References m_pThrd.

bogotel::CTimer::~CTimer  )  [virtual]
 

Definition at line 33 of file Timer.cpp.

References m_bStop, m_condStop, and m_pThrd.


Member Function Documentation

void bogotel::CTimer::run  ) 
 

Definition at line 55 of file Timer.cpp.

References checkForExpirations(), handleDefunctTargets(), m_bStop, m_condStop, m_mtxStop, and m_period.

void bogotel::CTimer::add long  lDelay,
CTimerTarget pTarget,
int  timerType = 0,
int  stateId = 0
 

Definition at line 153 of file Timer.cpp.

References bogotel::g_util, bogotel::CUtil::log(), m_lstTimer, m_mtxTimerInfoList, m_period, bogotel::timer_info::m_pTarget, and bogotel::timer_info::toString().

void bogotel::CTimer::do_thread void *  param  )  [static]
 

Definition at line 41 of file Timer.cpp.

References bogotel::g_util, and bogotel::CUtil::log().

int bogotel::CTimer::registerTarget CTimerTarget pTarget  ) 
 

Definition at line 175 of file Timer.cpp.

References bogotel::g_util, bogotel::CTimerTarget::getId(), bogotel::CUtil::log(), m_mtxActiveTimerSet, m_setActive, bogotel::resultFUNC_BAD_PARAMETER, bogotel::resultSUCCESS, and bogotel::CTimerTarget::toString().

Referenced by bogotel::CVoiceDev::registerIoOp().

void bogotel::CTimer::requestTargetDeletion CTimerTarget pTarget  ) 
 

Definition at line 192 of file Timer.cpp.

References bogotel::g_util, bogotel::CUtil::log(), m_mtxDefunctVec, m_vecDefunct, and bogotel::CTimerTarget::toString().

Referenced by bogotel::CVoiceDev::terminateIoOp().

void bogotel::CTimer::checkForExpirations  )  [private]
 

Todo:
check which takes more time

Definition at line 68 of file Timer.cpp.

References bogotel::g_util, bogotel::CTimerTarget::getId(), bogotel::CUtil::log(), bogotel::timer_info::m_count, bogotel::timer_info::m_iTargetStateId, bogotel::timer_info::m_iTimerType, m_lstTimer, bogotel::timer_info::m_lTargetId, m_mtxTimerInfoList, bogotel::timer_info::m_pTarget, targetIsActive(), bogotel::CTimerTarget::timerExpired(), bogotel::timer_info::toString(), and bogotel::CTimerTarget::toString().

Referenced by run().

void bogotel::CTimer::handleDefunctTargets  )  [private]
 

Delete all targets in the defunctTargets vector. Remove them from the active timers set to avoid attempts to send expiring timers to them.

Definition at line 122 of file Timer.cpp.

References bogotel::g_util, bogotel::CTimerTarget::getId(), bogotel::CUtil::log(), m_mtxActiveTimerSet, m_mtxDefunctVec, m_setActive, m_vecDefunct, and bogotel::CTimerTarget::toString().

Referenced by run().

bool bogotel::CTimer::targetIsActive long  lTargetId  )  [private]
 

Definition at line 111 of file Timer.cpp.

References m_mtxActiveTimerSet, and m_setActive.

Referenced by checkForExpirations().


Field Documentation

boost::thread* bogotel::CTimer::m_pThrd [private]
 

Definition at line 129 of file Timer.h.

Referenced by CTimer(), and ~CTimer().

boost::mutex bogotel::CTimer::m_mtxTimerInfoList [private]
 

Definition at line 130 of file Timer.h.

Referenced by add(), and checkForExpirations().

boost::mutex bogotel::CTimer::m_mtxActiveTimerSet [private]
 

Definition at line 131 of file Timer.h.

Referenced by handleDefunctTargets(), registerTarget(), and targetIsActive().

boost::mutex bogotel::CTimer::m_mtxDefunctVec [private]
 

Definition at line 132 of file Timer.h.

Referenced by handleDefunctTargets(), and requestTargetDeletion().

boost::mutex bogotel::CTimer::m_mtxStop [private]
 

Definition at line 133 of file Timer.h.

Referenced by run().

boost::condition bogotel::CTimer::m_condStop [private]
 

Definition at line 134 of file Timer.h.

Referenced by run(), and ~CTimer().

bool bogotel::CTimer::m_bStop [private]
 

Definition at line 135 of file Timer.h.

Referenced by run(), and ~CTimer().

int bogotel::CTimer::m_period [private]
 

Definition at line 137 of file Timer.h.

Referenced by add(), and run().

LST_TIMER bogotel::CTimer::m_lstTimer [private]
 

Definition at line 140 of file Timer.h.

Referenced by add(), and checkForExpirations().

SET_LONG bogotel::CTimer::m_setActive [private]
 

Definition at line 142 of file Timer.h.

Referenced by handleDefunctTargets(), registerTarget(), and targetIsActive().

VEC_TIMERTARGET bogotel::CTimer::m_vecDefunct [private]
 

Definition at line 144 of file Timer.h.

Referenced by handleDefunctTargets(), and requestTargetDeletion().


The documentation for this class was generated from the following files:
Generated on Tue Aug 12 12:42:31 2003 for bogotel by doxygen 1.3. Hosted by SourceForge.net Logo