diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2013-05-08 22:05:11 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2013-05-08 22:05:11 +0000 |
commit | 219118b4d5ea915eb6cbe9c2fa8e0903a3ad0d1e (patch) | |
tree | 7ac9177235ea6d8d2ba8cfd3d2a012711832d3fb | |
parent | 0a10b860c60175a85c3fe79eac04e1e7cf52ca99 (diff) | |
download | ATCD-219118b4d5ea915eb6cbe9c2fa8e0903a3ad0d1e.tar.gz |
Wed May 8 21:42:24 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | ACE/ChangeLog_Asynch_ImR | 17 | ||||
-rw-r--r-- | ACE/ace/Countdown_Time_T.cpp | 6 | ||||
-rw-r--r-- | ACE/ace/Countdown_Time_T.h | 5 |
3 files changed, 25 insertions, 3 deletions
diff --git a/ACE/ChangeLog_Asynch_ImR b/ACE/ChangeLog_Asynch_ImR new file mode 100644 index 00000000000..f3025079b70 --- /dev/null +++ b/ACE/ChangeLog_Asynch_ImR @@ -0,0 +1,17 @@ +Wed May 8 21:42:24 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> + + * ace/Countdown_Time_T.cpp: + * ace/Countdown_Time_T.h: + + Make the countdown time instances nestable. Prior to this change, + if a function using the countdown time to subtract a duration + happened to call another function that also used a countdown time + instance to subtract from the same instance, the inner countdown + would subtract its span and then the outer one would do the same + resulting in the same span of time being subtracted twice. + +Local Variables: +mode: change-log +add-log-time-format: (lambda () (progn (setq tz (getenv "TZ")) (set-time-zone-rule "UTC") (setq time (format-time-string "%a %b %e %H:%M:%S %Z %Y" (current-time))) (set-time-zone-rule tz) time)) +indent-tabs-mode: nil +End: diff --git a/ACE/ace/Countdown_Time_T.cpp b/ACE/ace/Countdown_Time_T.cpp index c59784207e5..cd775d882b0 100644 --- a/ACE/ace/Countdown_Time_T.cpp +++ b/ACE/ace/Countdown_Time_T.cpp @@ -16,6 +16,7 @@ ACE_Countdown_Time_T<TIME_POLICY>::ACE_Countdown_Time_T (ACE_Time_Value *max_wai TIME_POLICY const & time_policy) : time_policy_ (time_policy), max_wait_time_ (max_wait_time), + max_wait_value_ (ACE_Time_Value::zero), stopped_ (false) { this->start (); @@ -32,6 +33,7 @@ ACE_Countdown_Time_T<TIME_POLICY>::start (void) { if (this->max_wait_time_ != 0) { + this->max_wait_value_ = *this->max_wait_time_; this->start_time_ = this->time_policy_ (); this->stopped_ = false; } @@ -46,9 +48,9 @@ ACE_Countdown_Time_T<TIME_POLICY>::stop (void) this->time_policy_ () - this->start_time_; if (elapsed_time >= ACE_Time_Value::zero && - *this->max_wait_time_ > elapsed_time) + this->max_wait_value_ > elapsed_time) { - *this->max_wait_time_ -= elapsed_time; + *this->max_wait_time_ = this->max_wait_value_ - elapsed_time; } else { diff --git a/ACE/ace/Countdown_Time_T.h b/ACE/ace/Countdown_Time_T.h index 481501af61e..4edb6ea1acc 100644 --- a/ACE/ace/Countdown_Time_T.h +++ b/ACE/ace/Countdown_Time_T.h @@ -70,9 +70,12 @@ private: /// The policy to return the current time of day TIME_POLICY time_policy_; - /// Maximum time we were willing to wait. + /// Maximum time we are monitoring ACE_Time_Value *max_wait_time_; + /// Copy of the maximum time value, used to avoid nested decrements + ACE_Time_Value max_wait_value_; + /// Beginning of the start time. ACE_Time_Value start_time_; |