Changeset 4828 for source/ariba/utility/system
- Timestamp:
- Jul 9, 2009, 11:08:45 AM (15 years ago)
- Location:
- source/ariba/utility/system
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/system/Timer.cpp
r3690 r4828 84 84 } 85 85 86 void 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 86 95 void Timer::stop() { 87 96 running = false; 97 reset(); // cause the sleep to abort 88 98 } 89 99 … … 97 107 98 108 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 100 117 if (obj->running) SystemQueue::instance().scheduleEvent( SystemEvent( obj, TimerEventType, NULL), 0 ); 101 118 if( obj->oneshot ) break; -
source/ariba/utility/system/Timer.h
r3690 r4828 65 65 ~Timer(); 66 66 67 /** 68 * Set the interval for the timer 69 * 70 * @param millis Timer interval in milliseconds 71 * @param oneshot Is this a one-shot or periodic timer 72 */ 67 73 void setInterval(unsigned int millis, bool oneshot=false); 74 75 /** 76 * Start the timer 77 */ 68 78 void start(); 79 80 /** 81 * Stop the timer 82 */ 69 83 void stop(); 84 85 /** 86 * Reset a running timer and ignore the remaining interval 87 * time. Start the timer with a new timer interval. 88 */ 89 void reset(); 70 90 71 91 protected:
Note:
See TracChangeset
for help on using the changeset viewer.