mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
capitalize public methods on timermgr (no code change)
This commit is contained in:
parent
1ba992073b
commit
6d76de5eaf
5 changed files with 33 additions and 33 deletions
|
@ -588,14 +588,14 @@ CookieRef::setAllConnectedTimer()
|
|||
{
|
||||
time_t inHowLong;
|
||||
inHowLong = RelayConfigs::GetConfigs()->GetAllConnectedInterval();
|
||||
TimerMgr::getTimerMgr()->setTimer( inHowLong,
|
||||
TimerMgr::GetTimerMgr()->SetTimer( inHowLong,
|
||||
s_checkAllConnected, this, 0 );
|
||||
}
|
||||
|
||||
void
|
||||
CookieRef::cancelAllConnectedTimer()
|
||||
{
|
||||
TimerMgr::getTimerMgr()->clearTimer( s_checkAllConnected, this );
|
||||
TimerMgr::GetTimerMgr()->ClearTimer( s_checkAllConnected, this );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -35,7 +35,7 @@ TimerMgr::TimerMgr()
|
|||
}
|
||||
|
||||
/* static */TimerMgr*
|
||||
TimerMgr::getTimerMgr()
|
||||
TimerMgr::GetTimerMgr()
|
||||
{
|
||||
static TimerMgr* mgr = NULL;
|
||||
if ( mgr == NULL ) {
|
||||
|
@ -45,7 +45,7 @@ TimerMgr::getTimerMgr()
|
|||
}
|
||||
|
||||
void
|
||||
TimerMgr::setTimer( time_t inMillis, TimerProc proc, void* closure,
|
||||
TimerMgr::SetTimer( time_t inMillis, TimerProc proc, void* closure,
|
||||
int interval )
|
||||
{
|
||||
logf( XW_LOGINFO, "setTimer: now = %d", now() );
|
||||
|
@ -68,7 +68,7 @@ TimerMgr::setTimer( time_t inMillis, TimerProc proc, void* closure,
|
|||
}
|
||||
|
||||
time_t
|
||||
TimerMgr::getPollTimeout()
|
||||
TimerMgr::GetPollTimeout()
|
||||
{
|
||||
MutexLock ml( &m_timersMutex );
|
||||
|
||||
|
@ -130,14 +130,14 @@ TimerMgr::figureNextFire()
|
|||
} /* figureNextFire */
|
||||
|
||||
void
|
||||
TimerMgr::clearTimer( TimerProc proc, void* closure )
|
||||
TimerMgr::ClearTimer( TimerProc proc, void* closure )
|
||||
{
|
||||
MutexLock ml( &m_timersMutex );
|
||||
clearTimerImpl( proc, closure );
|
||||
}
|
||||
|
||||
void
|
||||
TimerMgr::fireElapsedTimers()
|
||||
TimerMgr::FireElapsedTimers()
|
||||
{
|
||||
pthread_mutex_lock( &m_timersMutex );
|
||||
|
||||
|
|
|
@ -33,38 +33,38 @@ typedef void (*TimerProc)( void* closure );
|
|||
class TimerMgr {
|
||||
|
||||
public:
|
||||
static TimerMgr* getTimerMgr();
|
||||
static TimerMgr* GetTimerMgr();
|
||||
|
||||
void setTimer( time_t inMillis, TimerProc proc, void* closure,
|
||||
int interval ); /* 0 means non-recurring */
|
||||
void clearTimer( TimerProc proc, void* closure );
|
||||
void SetTimer( time_t inMillis, TimerProc proc, void* closure,
|
||||
int interval ); /* 0 means non-recurring */
|
||||
void ClearTimer( TimerProc proc, void* closure );
|
||||
|
||||
time_t getPollTimeout();
|
||||
void fireElapsedTimers();
|
||||
time_t GetPollTimeout();
|
||||
void FireElapsedTimers();
|
||||
|
||||
private:
|
||||
|
||||
typedef struct {
|
||||
TimerProc proc;
|
||||
void* closure;
|
||||
time_t when;
|
||||
int interval;
|
||||
} TimerInfo;
|
||||
typedef struct {
|
||||
TimerProc proc;
|
||||
void* closure;
|
||||
time_t when;
|
||||
int interval;
|
||||
} TimerInfo;
|
||||
|
||||
|
||||
TimerMgr();
|
||||
static void sighandler( int signal );
|
||||
TimerMgr();
|
||||
static void sighandler( int signal );
|
||||
|
||||
/* run once we have the mutex */
|
||||
void clearTimerImpl( TimerProc proc, void* closure );
|
||||
int getTimer( TimerProc proc, void* closure );
|
||||
void figureNextFire();
|
||||
/* run once we have the mutex */
|
||||
void clearTimerImpl( TimerProc proc, void* closure );
|
||||
int getTimer( TimerProc proc, void* closure );
|
||||
void figureNextFire();
|
||||
|
||||
pthread_mutex_t m_timersMutex;
|
||||
list<TimerInfo> m_timers;
|
||||
pthread_mutex_t m_timersMutex;
|
||||
list<TimerInfo> m_timers;
|
||||
|
||||
time_t m_nextFireTime;
|
||||
time_t m_heartbeat;
|
||||
time_t m_nextFireTime;
|
||||
time_t m_heartbeat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -216,7 +216,7 @@ void*
|
|||
XWThreadPool::real_listener()
|
||||
{
|
||||
int flags = POLLIN | POLLERR | POLLHUP;
|
||||
TimerMgr* tmgr = TimerMgr::getTimerMgr();
|
||||
TimerMgr* tmgr = TimerMgr::GetTimerMgr();
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
|
@ -242,13 +242,13 @@ XWThreadPool::real_listener()
|
|||
}
|
||||
pthread_rwlock_unlock( &m_activeSocketsRWLock );
|
||||
|
||||
int nMillis = tmgr->getPollTimeout();
|
||||
int nMillis = tmgr->GetPollTimeout();
|
||||
|
||||
logf( XW_LOGINFO, "polling %s", log );
|
||||
int nEvents = poll( fds, nSockets, nMillis ); /* -1: infinite timeout */
|
||||
logf( XW_LOGINFO, "back from poll: %d", nEvents );
|
||||
if ( nEvents == 0 ) {
|
||||
tmgr->fireElapsedTimers();
|
||||
tmgr->FireElapsedTimers();
|
||||
} else if ( nEvents < 0 ) {
|
||||
logf( XW_LOGERROR, "errno: %d", errno );
|
||||
}
|
||||
|
|
|
@ -535,7 +535,7 @@ int main( int argc, char** argv )
|
|||
tPool->Setup( nWorkerThreads, processMessage );
|
||||
|
||||
short heartbeat = cfg->GetHeartbeatInterval();
|
||||
TimerMgr::getTimerMgr()->setTimer( heartbeat, HeartbeatProc, NULL,
|
||||
TimerMgr::GetTimerMgr()->SetTimer( heartbeat, HeartbeatProc, NULL,
|
||||
heartbeat );
|
||||
|
||||
/* set up select call */
|
||||
|
|
Loading…
Reference in a new issue