コード例 #1
0
ファイル: timer.cpp プロジェクト: catompiler/celestial-battle
void Timer::_timer_proc()
{
    _onTimer();
}
コード例 #2
0
ファイル: pmdObjBase.hpp プロジェクト: 247687009/SequoiaDB
   OSS_INLINE INT32 _pmdObjBase::dispatchEvent( pmdEDUEvent * event,
                                                INT32 *pTime )
   {
      _bProcess = TRUE ;
      INT32 rc = SDB_OK;
      time_t bTime = 0 ;
      INT32  diffTime = 0 ;

      const _msgMap* msgMap = NULL;
      for (msgMap = getMsgMap(); msgMap != NULL; 
               msgMap = (*msgMap->pfnGetBaseMap)())
      {
         UINT32 index = 0;
         while ( msgMap->entries[index].msgSig != sig_end )
         {
            if ( msgMap->entries[index].msgSig == sig_event
               && msgMap->entries[index].msgType <= (UINT32)(event->_eventType)
               && msgMap->entries[index].msgEndType >=
                  (UINT32)(event->_eventType) )
            {
               bTime = time( NULL ) ;
               rc =  (this->*(msgMap->entries[index].pEventFn))( event );
               diffTime = (INT32)(time( NULL ) - bTime) ;
               if ( SDB_OK != rc )
               {
                  PD_LOG( PDDEBUG, "[%s]Process func[%s] failed[rc = %d]",
                     name(), msgMap->entries[index].pFncName, rc );
               }
               goto done;
            }
            index++;
         }
      }

      if ( event->_eventType== PMD_EDU_EVENT_TIMEOUT )
      {
         PMD_EVENT_MESSAGES *timeMsg = (PMD_EVENT_MESSAGES*)( event->_Data );

         bTime = time( NULL ) ;
         _onTimer( timeMsg->timeoutMsg.timerID, timeMsg->timeoutMsg.interval,
                   timeMsg->timeoutMsg.occurTime ) ;
         diffTime = (INT32)(time( NULL ) - bTime) ;
      }
      else //Default Func
      {
         bTime = time( NULL ) ;
         rc = _defaultEventFunc( event );
         diffTime = (INT32)(time( NULL ) - bTime) ;
      }

   done:
      _bProcess = FALSE ;
      if ( pTime )
      {
         *pTime = diffTime ;
      }
      else if ( diffTime > 5 )
      {
         PD_LOG( PDINFO, "[%s] Process event[type:%d] over %d seconds", name(),
                 event->_eventType, diffTime ) ;
      }

      return rc;
   }