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

Public Member Functions | |
| ACE_Countdown_Time (ACE_Time_Value *max_wait_time) | |
Cache the max_wait_time and call start(). | |
| ~ACE_Countdown_Time (void) | |
| void | start (void) |
| Cache the current time and enter a start state. | |
| void | stop (void) |
| void | update (void) |
| bool | stopped (void) const |
| Returns true if we've already been stopped, else false. | |
Private Member Functions | |
| ACE_Countdown_Time (const ACE_Countdown_Time &) | |
| ACE_Countdown_Time & | operator= (const ACE_Countdown_Time &) |
Private Attributes | |
| ACE_Time_Value * | max_wait_time_ |
| Maximum time we were willing to wait. | |
| ACE_Time_Value | start_time_ |
| Beginning of the start time. | |
| bool | stopped_ |
| Keeps track of whether we've already been stopped. | |
This class has a side-effect on the max_wait_time -- every time the method is called the is updated.
Definition at line 37 of file Countdown_Time.h.
|
|
Cache the max_wait_time and call
Definition at line 10 of file Countdown_Time.cpp. References start().
00011 : max_wait_time_ (max_wait_time), 00012 stopped_ (false) 00013 { 00014 this->start (); 00015 } |
|
|
Destructor, makes sure the max_wait_time that got passed as pointer to the constructor is updated with the time elapsed. Definition at line 17 of file Countdown_Time.cpp. References stop().
00018 {
00019 this->stop ();
00020 }
|
|
|
|
|
|
|
|
|
Cache the current time and enter a start state.
Definition at line 23 of file Countdown_Time.cpp. References ACE_OS::gettimeofday(), max_wait_time_, start_time_, and stopped_. Referenced by ACE_Countdown_Time(), and update().
00024 {
00025 if (this->max_wait_time_ != 0)
00026 {
00027 this->start_time_ = ACE_OS::gettimeofday ();
00028 this->stopped_ = false;
00029 }
00030 }
|
|
|
Subtract the elapsed time from max_wait_time_ and enter a stopped state. Definition at line 39 of file Countdown_Time.cpp. References ACE_OS::gettimeofday(), max_wait_time_, start_time_, and stopped_. Referenced by update(), and ~ACE_Countdown_Time().
00040 {
00041 if (this->max_wait_time_ != 0 && this->stopped_ == false)
00042 {
00043 ACE_Time_Value elapsed_time = ACE_OS::gettimeofday () - this->start_time_;
00044
00045 if (*this->max_wait_time_ > elapsed_time)
00046 {
00047 *this->max_wait_time_ -= elapsed_time;
00048 }
00049 else
00050 {
00051 // Used all of timeout.
00052 *this->max_wait_time_ = ACE_Time_Value::zero;
00053 // errno = ETIME;
00054 }
00055 this->stopped_ = true;
00056 }
00057 }
|
|
|
Returns true if we've already been stopped, else false.
Definition at line 33 of file Countdown_Time.cpp. References stopped_.
00034 {
00035 return stopped_;
00036 }
|
|
|
Calls stop and then start. max_wait_time_ is modified by the call to stop. Definition at line 60 of file Countdown_Time.cpp. References start(), and stop(). Referenced by ACE_TP_Reactor::handle_events(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::handle_events(), ACE_Process_Manager::wait(), and ACE_Process::wait().
|
|
|
Maximum time we were willing to wait.
Definition at line 64 of file Countdown_Time.h. |
|
|
Beginning of the start time.
Definition at line 67 of file Countdown_Time.h. |
|
|
Keeps track of whether we've already been stopped.
Definition at line 70 of file Countdown_Time.h. |
1.3.6