[timer] Add 'disarm' method

pull/228/head
Suresh Sundriyal 9 years ago
parent 99094a9cf8
commit da582ce00f

@ -47,7 +47,7 @@ int timer::interrupt_timer::arm_timer() {
return 0; return 0;
} }
timer::interrupt_timer::~interrupt_timer() { void timer::interrupt_timer::disarm_timer() {
if (this->armed) { if (this->armed) {
// Disable the interval timer before resetting the handler and rearming // Disable the interval timer before resetting the handler and rearming
// the previous interval timer or else we will have a race-condition // the previous interval timer or else we will have a race-condition
@ -70,3 +70,7 @@ timer::interrupt_timer::~interrupt_timer() {
} }
} }
} }
timer::interrupt_timer::~interrupt_timer() {
this->disarm_timer();
}

@ -23,6 +23,7 @@ class interrupt_timer {
public: public:
interrupt_timer(struct timeval, sighandler_t_); interrupt_timer(struct timeval, sighandler_t_);
int arm_timer(); int arm_timer();
void disarm_timer();
~interrupt_timer(); ~interrupt_timer();
private: private:
sighandler_t_ new_handler, old_handler; sighandler_t_ new_handler, old_handler;

Loading…
Cancel
Save