void end_test(struct tester *tester, su_timer_t *t, struct timing *ti) { printf("ending test\n"); su_timer_destroy(t); su_timer_reset(tester->t); su_timer_reset(tester->t1); su_root_break(tester->root); }
/**@internal Do not refresh. */ void nua_dialog_usage_reset_refresh(nua_dialog_usage_t *du) { if (du) { if (du->du_refresh_timer) { su_timer_reset(du->du_refresh_timer); } du->du_refquested = sip_now(); } }
void print_stamp(struct tester *x, su_timer_t *t, struct timing *ti) { su_time_t now = su_now(), prev = ti->t_prev; ti->t_prev = now; printf("timer interval %f\n", 1000 * su_time_diff(now, prev)); if (!ti->t_run) su_timer_set(t, print_stamp, ti); if (++ti->t_times >= 10) su_timer_reset(t); }
void TimerQueue::remove( TimerEventHandle entry) { #ifndef TEST DR_LOG(log_debug) << m_name << ": removing entry, prior to removal length: " << dec << m_length; #endif //self check assert( m_length == numberOfElements()) ; assert( 0 != m_length || (NULL == m_head && NULL == m_tail) ) ; assert( 1 != m_length || (m_head == m_tail)) ; assert( m_length < 2 || (m_head != m_tail)) ; assert( !(NULL == m_head && NULL != m_tail)) ; assert( !(NULL == m_tail && NULL != m_head)) ; assert( m_head && m_length >= 1 ) ; int queueLength ; { if( m_head == entry ) { m_head = entry->m_next ; if( m_head ) m_head->m_prev = NULL ; else { assert( 1 == m_length ) ; m_tail = NULL ; } } else if( m_tail == entry ) { assert( m_head && entry->m_prev ) ; m_tail = entry->m_prev ; m_tail->m_next = NULL ; } else { assert( entry->m_prev ) ; assert( entry->m_next ) ; entry->m_prev->m_next = entry->m_next ; entry->m_next->m_prev = entry->m_prev ; } m_length-- ; assert( m_length >= 0 ) ; if( NULL == m_head ) { #ifndef TEST DR_LOG(log_debug) << m_name << ": removed entry, timer not set (queue is empty after removal), length: " << dec << m_length; #endif //std::cout << "timer not set (queue is empty after removal)" << std::endl; su_timer_reset( m_timer ) ; } else if( m_head == entry->m_next ) { #ifndef TEST DR_LOG(log_debug) << m_name << ": removed entry, setting timer for " << std::dec << su_duration( m_head->m_when, su_now() ) << "ms after removal, length: " << dec << m_length; #endif //std::cout << "Setting timer for " << su_duration( m_head->m_when, su_now() ) << "ms after removal of head entry" << std::endl; int rc = su_timer_set_at(m_timer, timer_function, this, m_head->m_when); } } //DR_LOG(log_debug) << "timer remove: queue length is now " << queueLength ; //std::cout << "timer remove: queue length is now " << queueLength << std::endl; delete entry ; //self check assert( m_length == numberOfElements()) ; assert( 0 != m_length || (NULL == m_head && NULL == m_tail) ) ; assert( 1 != m_length || (m_head == m_tail)) ; assert( m_length < 2 || (m_head != m_tail)) ; assert( !(NULL == m_head && NULL != m_tail)) ; assert( !(NULL == m_tail && NULL != m_head)) ; }