#include <Countdown_Time.h>
Collaboration diagram for ACE_Countdown_Time:
Public Member Functions | |
ACE_Countdown_Time (ACE_Time_Value *max_wait_time) | |
Cache the and call . | |
~ACE_Countdown_Time (void) | |
Call . | |
int | start (void) |
Cache the current time and enter a start state. | |
int | stop (void) |
int | update (void) |
int | stopped (void) const |
Returns 1 if we've already been stopped, else 0. | |
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. | |
int | stopped_ |
Keeps track of whether we've already been stopped. |
This class has a side-effect on the -- every time the method is called the is updated.
Definition at line 37 of file Countdown_Time.h.
|
Cache the and call .
Definition at line 10 of file Countdown_Time.cpp. References start().
00011 : max_wait_time_ (max_wait_time), 00012 stopped_ (0) 00013 { 00014 this->start (); 00015 } |
|
Call .
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_ = 0; 00029 } 00030 return 0; 00031 } |
|
Subtract the elapsed time from max_wait_time_ and enter a stopped state. Definition at line 40 of file Countdown_Time.cpp. References ACE_OS::gettimeofday(), max_wait_time_, start_time_, and stopped_. Referenced by update(), and ~ACE_Countdown_Time().
00041 { 00042 if (this->max_wait_time_ != 0 && this->stopped_ == 0) 00043 { 00044 ACE_Time_Value elapsed_time = 00045 ACE_OS::gettimeofday () - this->start_time_; 00046 00047 if (*this->max_wait_time_ > elapsed_time) 00048 *this->max_wait_time_ -= elapsed_time; 00049 else 00050 { 00051 // Used all of timeout. 00052 *this->max_wait_time_ = ACE_Time_Value::zero; 00053 // errno = ETIME; 00054 } 00055 this->stopped_ = 1; 00056 } 00057 return 0; 00058 } |
|
Returns 1 if we've already been stopped, else 0.
Definition at line 34 of file Countdown_Time.cpp. References stopped_.
00035 { 00036 return stopped_; 00037 } |
|
Calls stop and then start. max_wait_time_ is modified by the call to stop. Definition at line 61 of file Countdown_Time.cpp. References start(), and stop(). Referenced by ACE_WFMO_Reactor::event_handling(), 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 63 of file Countdown_Time.h. |
|
Beginning of the start time.
Definition at line 66 of file Countdown_Time.h. |
|
Keeps track of whether we've already been stopped.
Definition at line 69 of file Countdown_Time.h. |