Ignore:
Timestamp:
Jul 9, 2009, 11:08:45 AM (15 years ago)
Author:
Christoph Mayer
Message:

timer reset function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/system/Timer.cpp

    r3690 r4828  
    8484}
    8585
     86void Timer::reset(){
     87#ifndef UNDERLAY_OMNET
     88        if(timerThread == NULL) return;
     89        timerThread->interrupt();
     90#else
     91        #error timer interruption not implemented for omnet
     92#endif
     93}
     94
    8695void Timer::stop() {
    8796        running = false;
     97        reset(); // cause the sleep to abort
    8898}
    8999
     
    97107
    98108        while( obj->running ) {
    99                 boost::this_thread::sleep( boost::posix_time::milliseconds(obj->millis) );
     109
     110                try{
     111                        boost::this_thread::sleep( boost::posix_time::milliseconds(obj->millis) );
     112                }catch(boost::thread_interrupted e){
     113                        // exception called when Timer::reset is called
     114                        // don't need to handle the exception
     115                }
     116
    100117                if (obj->running) SystemQueue::instance().scheduleEvent( SystemEvent( obj, TimerEventType, NULL), 0 );
    101118                if( obj->oneshot ) break;
Note: See TracChangeset for help on using the changeset viewer.