#include <OS.h>
Collaboration diagram for ACE_Countdown_Time:

Public Methods | |
| ACE_Countdown_Time (ACE_Time_Value *max_wait_time) | |
| Cache the <max_wait_time> and call <start>. More... | |
| ~ACE_Countdown_Time (void) | |
| Call <stop>. More... | |
| int | start (void) |
| Cache the current time and enter a start state. More... | |
| int | stop (void) |
| Subtract the elapsed time from max_wait_time_ and enter a stopped state. More... | |
| int | update (void) |
| Calls stop and then start. max_wait_time_ is modified by the call to stop. More... | |
| int | stopped (void) const |
| Returns 1 if we've already been stopped, else 0. More... | |
Private Attributes | |
| ACE_Time_Value * | max_wait_time_ |
| Maximum time we were willing to wait. More... | |
| ACE_Time_Value | start_time_ |
| Beginning of the start time. More... | |
| int | stopped_ |
| Keeps track of whether we've already been stopped. More... | |
This class has a side-effect on the <max_wait_time> -- every time the <stop> method is called the <max_wait_time> is updated.
Definition at line 668 of file OS.h.
|
|
Cache the <max_wait_time> and call <start>.
Definition at line 401 of file OS.cpp. References start.
00402 : max_wait_time_ (max_wait_time), 00403 stopped_ (0) 00404 { 00405 this->start (); 00406 } |
|
|
Call <stop>.
Definition at line 408 of file OS.cpp. References stop.
00409 {
00410 this->stop ();
00411 }
|
|
|
Cache the current time and enter a start state.
Definition at line 11094 of file OS.i. References ACE_OS::gettimeofday, max_wait_time_, start_time_, and stopped_. Referenced by ACE_Countdown_Time, and update.
11095 {
11096 if (this->max_wait_time_ != 0)
11097 {
11098 this->start_time_ = ACE_OS::gettimeofday ();
11099 this->stopped_ = 0;
11100 }
11101 return 0;
11102 }
|
|
|
Subtract the elapsed time from max_wait_time_ and enter a stopped state.
Definition at line 11111 of file OS.i. References ACE_OS::gettimeofday, max_wait_time_, start_time_, stopped_, and ACE_Time_Value::zero. Referenced by update, and ~ACE_Countdown_Time.
11112 {
11113 if (this->max_wait_time_ != 0 && this->stopped_ == 0)
11114 {
11115 ACE_Time_Value elapsed_time =
11116 ACE_OS::gettimeofday () - this->start_time_;
11117
11118 if (*this->max_wait_time_ > elapsed_time)
11119 *this->max_wait_time_ -= elapsed_time;
11120 else
11121 {
11122 // Used all of timeout.
11123 *this->max_wait_time_ = ACE_Time_Value::zero;
11124 // errno = ETIME;
11125 }
11126 this->stopped_ = 1;
11127 }
11128 return 0;
11129 }
|
|
|
Returns 1 if we've already been stopped, else 0.
Definition at line 11105 of file OS.i. References stopped_.
11106 {
11107 return stopped_;
11108 }
|
|
|
Calls stop and then start. max_wait_time_ is modified by the call to stop.
Definition at line 11132 of file OS.i. Referenced by ACE_WFMO_Reactor::event_handling, ACE_TP_Reactor::handle_events, ACE_Select_Reactor_T::handle_events, ACE_Process_Manager::wait, and ACE_Process::wait.
|
|
|
Maximum time we were willing to wait.
|
|
|
Beginning of the start time.
|
|
|
Keeps track of whether we've already been stopped.
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002