summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2013-05-13 17:36:26 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2013-05-13 17:36:26 +0000
commite2a9541279f8aa4e6c19611327b029ac795b3615 (patch)
treeb70fba6394de17a83fe5dfb92b133f832cb56d2f
parenteb5e737bb94341f2f5596048ed16fc3802a0be7d (diff)
downloadATCD-e2a9541279f8aa4e6c19611327b029ac795b3615.tar.gz
Mon May 13 17:27:37 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r--ACE/ChangeLog16
-rw-r--r--ACE/ace/Countdown_Time_T.cpp6
-rw-r--r--ACE/ace/Countdown_Time_T.h5
3 files changed, 24 insertions, 3 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index f0f1e907144..ff31c9519e0 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,19 @@
+Mon May 13 17:27:37 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
+
+ Merging from branch OCI_Asynch_IMR:
+ 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.
+
+
Mon May 13 17:34:28 UTC 2013 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/INET_Addr_Test.cpp:
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_;