void IncrementalSweeper::willFinishSweeping() { m_currentBlockToSweepIndex = 0; m_blocksToSweep.clear(); if (m_globalData) cancelTimer(); }
void updateTimer(int tid){ int i; static int cou=0; switch(tid){ case 0: stage=0; keyTimer(tid); mapTimer(tid); break; case 1: stage=1; keyTimer(tid); menuTimer(tid); break; case 2: cou++; stage=3; menuTimer(tid); if (cou==30) { cancelTimer(2); startTimer(0,10); level=1; initMap(1); cou=0; for(i=0;i<=buttonCount;i++) { allButton[i].up=1; } } } }
static void prepareBalloonHelp( wWin_p w, wPos_t x, wPos_t y ) { #ifdef XV wControl_p b; char * hs; int appNameLen = strlen( wAppName ) + 1; if (w == NULL) return; #ifdef LATER if (!enableBalloonHelp) return; #endif if (!balloonHelpStrings) return; balloonHelp_w = w; balloonHelp_x = x; balloonHelp_y = y; for ( b=w->first; b; b=b->next ) { switch ( b->type ) { case B_BUTTON: case B_CANCEL: case B_TEXT: case B_INTEGER: case B_LIST: case B_DROPLIST: case B_COMBOLIST: case B_RADIO: case B_TOGGLE: case B_DRAW: case B_MULTITEXT: if (x >= b->realX && x < b->realX+b->w && y >= b->realY && y < b->realY+b->h ) { hs = (char*)gtk_get( b->panel_item, XV_HELP_DATA ); if ( hs ) { hs += appNameLen; for ( currBalloonHelp = balloonHelpStrings; currBalloonHelp->name && strcmp(currBalloonHelp->name,hs) != 0; currBalloonHelp++ ); if (currBalloonHelp->name && balloonHelpB != b && currBalloonHelp->value ) { balloonHelpB = b; balloonHelpString = currBalloonHelp->value; if (enableBalloonHelp) { wControlSetBalloon( balloonHelpB, 0, 0, balloonHelpString ); /*setTimer( balloonHelpTimeOut, showBalloonHelp );*/ } else { /*resetBalloonHelp();*/ } } return; } } default: ; } } cancelTimer( showBalloonHelp ); resetBalloonHelp(); #endif }
bool CntAbstractSimRequest::cancel() { if (m_request->isActive()) { cancelTimer(); simStore()->cancel(); QContactManagerEngine::updateRequestState(m_request, QContactAbstractRequest::CanceledState); return true; } return false; }
//remaining delete void run(int tid) { static int times=0; int startx=220,starty=400; runbar(startx,starty,times*5,30); ++times; if (times==150) { cancelTimer(tid); startTimer(tid-1,10); } }
void SelfDrainingQueue::timerHandler( void ) { dprintf( D_FULLDEBUG, "Inside SelfDrainingQueue::timerHandler() for %s\n", name ); if( queue.IsEmpty() ) { dprintf( D_FULLDEBUG, "SelfDrainingQueue %s is empty, " "timerHandler() has nothing to do\n", name ); cancelTimer(); return; } int count; for( count=0; count<m_count_per_interval && !queue.IsEmpty(); count++ ) { ServiceData* d = NULL; queue.dequeue(d); SelfDrainingHashItem hash_item(d); m_hash.remove(hash_item); if( handler_fn ) { handler_fn( d ); } else if( handlercpp_fn && service_ptr ) { (service_ptr->*handlercpp_fn)( d ); } } if( queue.IsEmpty() ) { dprintf( D_FULLDEBUG, "SelfDrainingQueue %s is empty, not resetting timer\n", name ); cancelTimer(); } else { // if there's anything left in the queue, reset our timer dprintf( D_FULLDEBUG, "SelfDrainingQueue %s still has %d element(s), " "resetting timer\n", name, queue.Length() ); resetTimer(); } }
SelfDrainingQueue::~SelfDrainingQueue() { cancelTimer(); if( name ) { free( name ); name = NULL; } if( timer_name ) { free( timer_name ); timer_name = NULL; } }
void Timer::startTimer(unsigned long timeMillis) { m_delayMillis = timeMillis; if (m_delayMillis > 0) { m_currentTimeMillis = UptimeInfo::tMillis(); startInterval(); } else { cancelTimer(); } }
void ConnectAttempt::onShutdown (error_code ec) { cancelTimer(); if (! ec) { JLOG(journal_.error()) << "onShutdown: expected error condition"; return close(); } if (ec != boost::asio::error::eof) return fail("onShutdown", ec); close(); }
void ConnectAttempt::onWrite (error_code ec) { cancelTimer(); if(! stream_.next_layer().is_open()) return; if(ec == boost::asio::error::operation_aborted) return; if(ec) return fail("onWrite", ec); boost::beast::http::async_read(stream_, read_buf_, response_, strand_.wrap(std::bind(&ConnectAttempt::onRead, shared_from_this(), std::placeholders::_1))); }
void LeftClickinmenu() { int i; i=findButton(mousex,mousey); if (i!=-1) { switch(allButton[i].event) { case PLAY: allButton[i].up=0; cancelTimer(1); startTimer(2,10); break; } } }
void IncrementalSweeper::doSweep(double sweepBeginTime) { while (m_currentBlockToSweepIndex < m_blocksToSweep.size()) { sweepNextBlock(); double elapsedTime = WTF::monotonicallyIncreasingTime() - sweepBeginTime; if (elapsedTime < sweepTimeSlice) continue; scheduleTimer(); return; } m_blocksToSweep.clear(); cancelTimer(); }
void ConnectAttempt::onRead (error_code ec) { cancelTimer(); if(! stream_.next_layer().is_open()) return; if(ec == boost::asio::error::operation_aborted) return; if(ec == boost::asio::error::eof) { JLOG(journal_.info()) << "EOF"; setTimer(); return stream_.async_shutdown(strand_.wrap(std::bind( &ConnectAttempt::onShutdown, shared_from_this(), std::placeholders::_1))); } if(ec) return fail("onRead", ec); processResponse(); }
void ConnectAttempt::onHandshake (error_code ec) { cancelTimer(); if(! stream_.next_layer().is_open()) return; if(ec == boost::asio::error::operation_aborted) return; endpoint_type local_endpoint; if (! ec) local_endpoint = stream_.next_layer().local_endpoint(ec); if(ec) return fail("onHandshake", ec); JLOG(journal_.trace()) << "onHandshake"; if (! overlay_.peerFinder().onConnected (slot_, beast::IPAddressConversion::from_asio (local_endpoint))) return fail("Duplicate connection"); auto sharedValue = makeSharedValue( stream_.native_handle(), journal_); if (! sharedValue) return close(); // makeSharedValue logs req_ = makeRequest(! overlay_.peerFinder().config().peerPrivate, remote_endpoint_.address()); auto const hello = buildHello ( *sharedValue, overlay_.setup().public_ip, beast::IPAddressConversion::from_asio(remote_endpoint_), app_); appendHello (req_, hello); setTimer(); boost::beast::http::async_write(stream_, req_, strand_.wrap (std::bind (&ConnectAttempt::onWrite, shared_from_this(), std::placeholders::_1))); }
void ConnectAttempt::onConnect (error_code ec) { cancelTimer(); if(ec == boost::asio::error::operation_aborted) return; endpoint_type local_endpoint; if(! ec) local_endpoint = stream_.next_layer().local_endpoint(ec); if(ec) return fail("onConnect", ec); if(! stream_.next_layer().is_open()) return; JLOG(journal_.trace()) << "onConnect"; setTimer(); stream_.set_verify_mode (boost::asio::ssl::verify_none); stream_.async_handshake (boost::asio::ssl::stream_base::client, strand_.wrap (std::bind (&ConnectAttempt::onHandshake, shared_from_this(), std::placeholders::_1))); }
void GCActivityCallback::cancel() { cancelTimer(); }
void DefaultGCActivityCallback::willCollect() { cancelTimer(); }
void DefaultGCActivityCallback::cancel() { cancelTimer(); }
int CwxAppEpoll::poll(REACTOR_CALLBACK callback, void* arg, CWX_UINT32 uiMiliTimeout) { static CWX_UINT64 ullLastTime=0; bool bClockChange = false; int i = 0; int num = 0; CWX_UINT64 ullNow = 0; CWX_UINT64 ullTimeout = 0; int tv=-1; struct epoll_event *event=NULL; CwxAppHandler4Base* handler = NULL; m_current.now(); ullNow = m_current.to_usec(); if (ullLastTime > ullNow + 1000000){ ///多余1秒 ullLastTime = ullNow; bClockChange = true; }else{ bClockChange = false; ullLastTime = ullNow; } ///计算超时时间 timeout(ullTimeout); if (ullTimeout){ if (ullTimeout < ullNow){ tv =1; }else{ ullTimeout -= ullNow; tv = ullTimeout/1000; if (tv < 1) tv = 1; } if (uiMiliTimeout && (tv > (int)uiMiliTimeout)) tv = uiMiliTimeout; }else if (uiMiliTimeout){ tv = uiMiliTimeout; } m_bStop = false; num = epoll_wait(m_epfd, m_events, CWX_APP_MAX_IO_NUM, tv); if (num > 0){ for (i = 0; i < num; i++){ int mask = 0; if (m_bStop) return 0; event = &m_events[i]; /* if (m_signalFd[0] == event->data.fd) { CWX_ASSERT(event->events == EPOLLIN); continue; }*/ CWX_ASSERT(m_eHandler[event->data.fd].m_handler); if (event->events & EPOLLIN) mask |= CwxAppHandler4Base::READ_MASK; if (event->events & EPOLLOUT) mask |= CwxAppHandler4Base::WRITE_MASK; handler = m_eHandler[event->data.fd].m_handler; //检测timeout if (m_eHandler[event->data.fd].m_handler->index()>=0) {//从heap中删除 if (0 != cancelTimer(m_eHandler[event->data.fd].m_handler)) { CWX_ERROR(("Failure to cancel hander's timer, fd[%d]", event->data.fd)); } } if (!CWX_CHECK_ATTR(m_eHandler[event->data.fd].m_mask, CwxAppHandler4Base::PERSIST_MASK)) { if (removeHandler(event->data.fd) != handler) { CWX_ASSERT(0); CWX_ERROR(("handler[%d] is not right", event->data.fd)); return -1; } } callback(handler, mask, CWX_CHECK_ATTR(m_eHandler[event->data.fd].m_mask, CwxAppHandler4Base::PERSIST_MASK), arg); } } //检测signal if (m_bSignal && m_bEnableSignal) { if (m_bStop) return 0; m_bSignal = 0; for (i=0; i<CWX_APP_MAX_SIGNAL_ID; i++) { if (m_arrSignals[i]) { m_arrSignals[i] = 0; CWX_ASSERT(m_sHandler[i]); callback(m_sHandler[i], CwxAppHandler4Base::SIGNAL_MASK, true, arg); } } } //检测超时 if (bClockChange){ list<CwxAppHandler4Base*> handles; while(!m_timeHeap.isEmpty()){ if (m_bStop) return 0; if (m_timeHeap.top()->getHandle() != CWX_INVALID_HANDLE){ handler = removeHandler(m_timeHeap.top()->getHandle()); if (!handler){ CWX_ERROR(("Failure to remove timeout handler, fd[%d]", event->data.fd)); } }else{ handler = m_timeHeap.pop(); } handles.push_back(handler); } list<CwxAppHandler4Base*>::iterator iter = handles.begin(); while(iter != handles.end()){ callback(*iter, CwxAppHandler4Base::TIMEOUT_MASK, false, arg); iter++; } }else{ while (!m_timeHeap.isEmpty() && (m_timeHeap.top()->getTimeout() < ullNow)){ if (m_bStop) return 0; if (m_timeHeap.top()->getHandle() != CWX_INVALID_HANDLE){ handler = removeHandler(m_timeHeap.top()->getHandle()); if (!handler){ CWX_ERROR(("Failure to remove timeout handler, fd[%d]", event->data.fd)); } }else{ handler = m_timeHeap.pop(); } callback(handler, CwxAppHandler4Base::TIMEOUT_MASK, false, arg); } } return 0; }