capitalize public methods on timermgr (no code change)

This commit is contained in:
ehouse 2005-10-15 15:49:22 +00:00
parent eb8301ade7
commit ecf5875d7e
5 changed files with 33 additions and 33 deletions

View file

@ -588,14 +588,14 @@ CookieRef::setAllConnectedTimer()
{ {
time_t inHowLong; time_t inHowLong;
inHowLong = RelayConfigs::GetConfigs()->GetAllConnectedInterval(); inHowLong = RelayConfigs::GetConfigs()->GetAllConnectedInterval();
TimerMgr::getTimerMgr()->setTimer( inHowLong, TimerMgr::GetTimerMgr()->SetTimer( inHowLong,
s_checkAllConnected, this, 0 ); s_checkAllConnected, this, 0 );
} }
void void
CookieRef::cancelAllConnectedTimer() CookieRef::cancelAllConnectedTimer()
{ {
TimerMgr::getTimerMgr()->clearTimer( s_checkAllConnected, this ); TimerMgr::GetTimerMgr()->ClearTimer( s_checkAllConnected, this );
} }
void void

View file

@ -35,7 +35,7 @@ TimerMgr::TimerMgr()
} }
/* static */TimerMgr* /* static */TimerMgr*
TimerMgr::getTimerMgr() TimerMgr::GetTimerMgr()
{ {
static TimerMgr* mgr = NULL; static TimerMgr* mgr = NULL;
if ( mgr == NULL ) { if ( mgr == NULL ) {
@ -45,7 +45,7 @@ TimerMgr::getTimerMgr()
} }
void void
TimerMgr::setTimer( time_t inMillis, TimerProc proc, void* closure, TimerMgr::SetTimer( time_t inMillis, TimerProc proc, void* closure,
int interval ) int interval )
{ {
logf( XW_LOGINFO, "setTimer: now = %d", now() ); logf( XW_LOGINFO, "setTimer: now = %d", now() );
@ -68,7 +68,7 @@ TimerMgr::setTimer( time_t inMillis, TimerProc proc, void* closure,
} }
time_t time_t
TimerMgr::getPollTimeout() TimerMgr::GetPollTimeout()
{ {
MutexLock ml( &m_timersMutex ); MutexLock ml( &m_timersMutex );
@ -130,14 +130,14 @@ TimerMgr::figureNextFire()
} /* figureNextFire */ } /* figureNextFire */
void void
TimerMgr::clearTimer( TimerProc proc, void* closure ) TimerMgr::ClearTimer( TimerProc proc, void* closure )
{ {
MutexLock ml( &m_timersMutex ); MutexLock ml( &m_timersMutex );
clearTimerImpl( proc, closure ); clearTimerImpl( proc, closure );
} }
void void
TimerMgr::fireElapsedTimers() TimerMgr::FireElapsedTimers()
{ {
pthread_mutex_lock( &m_timersMutex ); pthread_mutex_lock( &m_timersMutex );

View file

@ -33,38 +33,38 @@ typedef void (*TimerProc)( void* closure );
class TimerMgr { class TimerMgr {
public: public:
static TimerMgr* getTimerMgr(); static TimerMgr* GetTimerMgr();
void setTimer( time_t inMillis, TimerProc proc, void* closure, void SetTimer( time_t inMillis, TimerProc proc, void* closure,
int interval ); /* 0 means non-recurring */ int interval ); /* 0 means non-recurring */
void clearTimer( TimerProc proc, void* closure ); void ClearTimer( TimerProc proc, void* closure );
time_t getPollTimeout(); time_t GetPollTimeout();
void fireElapsedTimers(); void FireElapsedTimers();
private: private:
typedef struct { typedef struct {
TimerProc proc; TimerProc proc;
void* closure; void* closure;
time_t when; time_t when;
int interval; int interval;
} TimerInfo; } TimerInfo;
TimerMgr(); TimerMgr();
static void sighandler( int signal ); static void sighandler( int signal );
/* run once we have the mutex */ /* run once we have the mutex */
void clearTimerImpl( TimerProc proc, void* closure ); void clearTimerImpl( TimerProc proc, void* closure );
int getTimer( TimerProc proc, void* closure ); int getTimer( TimerProc proc, void* closure );
void figureNextFire(); void figureNextFire();
pthread_mutex_t m_timersMutex; pthread_mutex_t m_timersMutex;
list<TimerInfo> m_timers; list<TimerInfo> m_timers;
time_t m_nextFireTime; time_t m_nextFireTime;
time_t m_heartbeat; time_t m_heartbeat;
}; };
#endif #endif

View file

@ -216,7 +216,7 @@ void*
XWThreadPool::real_listener() XWThreadPool::real_listener()
{ {
int flags = POLLIN | POLLERR | POLLHUP; int flags = POLLIN | POLLERR | POLLHUP;
TimerMgr* tmgr = TimerMgr::getTimerMgr(); TimerMgr* tmgr = TimerMgr::GetTimerMgr();
for ( ; ; ) { for ( ; ; ) {
@ -242,13 +242,13 @@ XWThreadPool::real_listener()
} }
pthread_rwlock_unlock( &m_activeSocketsRWLock ); pthread_rwlock_unlock( &m_activeSocketsRWLock );
int nMillis = tmgr->getPollTimeout(); int nMillis = tmgr->GetPollTimeout();
logf( XW_LOGINFO, "polling %s", log ); logf( XW_LOGINFO, "polling %s", log );
int nEvents = poll( fds, nSockets, nMillis ); /* -1: infinite timeout */ int nEvents = poll( fds, nSockets, nMillis ); /* -1: infinite timeout */
logf( XW_LOGINFO, "back from poll: %d", nEvents ); logf( XW_LOGINFO, "back from poll: %d", nEvents );
if ( nEvents == 0 ) { if ( nEvents == 0 ) {
tmgr->fireElapsedTimers(); tmgr->FireElapsedTimers();
} else if ( nEvents < 0 ) { } else if ( nEvents < 0 ) {
logf( XW_LOGERROR, "errno: %d", errno ); logf( XW_LOGERROR, "errno: %d", errno );
} }

View file

@ -535,7 +535,7 @@ int main( int argc, char** argv )
tPool->Setup( nWorkerThreads, processMessage ); tPool->Setup( nWorkerThreads, processMessage );
short heartbeat = cfg->GetHeartbeatInterval(); short heartbeat = cfg->GetHeartbeatInterval();
TimerMgr::getTimerMgr()->setTimer( heartbeat, HeartbeatProc, NULL, TimerMgr::GetTimerMgr()->SetTimer( heartbeat, HeartbeatProc, NULL,
heartbeat ); heartbeat );
/* set up select call */ /* set up select call */