summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ACE/ChangeLog31
-rw-r--r--ACE/ace/Abstract_Timer_Queue.h2
-rw-r--r--ACE/ace/Dev_Poll_Reactor.cpp2
-rw-r--r--ACE/ace/Proactor.cpp5
-rw-r--r--ACE/ace/Select_Reactor_T.cpp2
-rw-r--r--ACE/ace/Timer_Hash_T.cpp2
-rw-r--r--ACE/ace/Timer_Hash_T.h2
-rw-r--r--ACE/ace/Timer_Queue_Adapters.cpp6
-rw-r--r--ACE/ace/Timer_Queue_T.cpp12
-rw-r--r--ACE/ace/Timer_Queue_T.h10
-rw-r--r--ACE/ace/Timer_Queue_T.inl6
-rw-r--r--ACE/examples/APG/Timers/TimerDispatcher.cpp4
-rw-r--r--ACE/examples/APG/Timers/Timers.cpp2
-rw-r--r--ACE/examples/C++NPv2/Logging_Event_Handler_Ex.cpp2
-rw-r--r--ACE/tests/Timer_Queue_Reference_Counting_Test.cpp16
-rw-r--r--ACE/tests/Timer_Queue_Test.cpp28
16 files changed, 82 insertions, 50 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 9e4b74041f5..f17597659b6 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,34 @@
+Thu Jul 2 02:55:09 UTC 2009 Carlos O'Ryan <coryan@glamdring>
+
+ * ace/Abstract_Timer_Queue.h:
+ * ace/Timer_Queue_T.h:
+ * ace/Timer_Queue_T.inl:
+ * ace/Timer_Queue_T.cpp:
+ I wanted to use gettimeofday() for the pure virtual function and
+ some other name for the inline function used in the timer queue
+ internals.
+ This is the second and final pass to get that change in. This
+ time, I renamed the internal function to gettimeofday_static(),
+ used the compiler (and grep) to find all uses. Once that
+ compiled I renamed the virtual function from
+ gettimeofday_abstract() to the gettimeofday() function.
+ I know it is convoluted, but it gets the job done without me
+ having to think too much.
+
+ * ace/Timer_Hash_T.h:
+ * ace/Timer_Hash_T.cpp:
+ * ace/Select_Reactor_T.cpp:
+ * ace/Dev_Poll_Reactor.cpp:
+ * ace/Proactor.cpp:
+ * ace/Timer_Queue_Adapters.cpp:
+ * tests/Timer_Queue_Reference_Counting_Test.cpp:
+ * tests/Timer_Queue_Test.cpp:
+ * examples/APG/Timers/Timers.cpp:
+ * examples/APG/Timers/TimerDispatcher.cpp:
+ * examples/C++NPv2/Logging_Event_Handler_Ex.cpp:
+ Fixed users and tests to use the real name for gettimeofday() in
+ ACE_Abstract_Timer_Queue<>
+
Wed Jul 1 02:09:44 UTC 2009 Carlos O'Ryan <coryan@glamdring>
* ace/ace.mpc:
diff --git a/ACE/ace/Abstract_Timer_Queue.h b/ACE/ace/Abstract_Timer_Queue.h
index 4e9fc299c71..f01817ccc7f 100644
--- a/ACE/ace/Abstract_Timer_Queue.h
+++ b/ACE/ace/Abstract_Timer_Queue.h
@@ -159,7 +159,7 @@ public:
* implementations of the timer queue to use special high resolution
* timers.
*/
- virtual ACE_Time_Value gettimeofday_abstract (void) = 0;
+ virtual ACE_Time_Value gettimeofday (void) = 0;
/// Determine the next event to timeout. Returns @a max if there are
/// no pending timers or if all pending timers are longer than max.
diff --git a/ACE/ace/Dev_Poll_Reactor.cpp b/ACE/ace/Dev_Poll_Reactor.cpp
index 3437398e124..ae871efe74a 100644
--- a/ACE/ace/Dev_Poll_Reactor.cpp
+++ b/ACE/ace/Dev_Poll_Reactor.cpp
@@ -1898,7 +1898,7 @@ ACE_Dev_Poll_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
return this->timer_queue_->schedule
(event_handler,
arg,
- this->timer_queue_->gettimeofday_abstract () + delay,
+ this->timer_queue_->gettimeofday () + delay,
interval);
errno = ESHUTDOWN;
diff --git a/ACE/ace/Proactor.cpp b/ACE/ace/Proactor.cpp
index b844dd1fe41..0bde90d5c9d 100644
--- a/ACE/ace/Proactor.cpp
+++ b/ACE/ace/Proactor.cpp
@@ -145,7 +145,8 @@ ACE_Proactor_Timer_Handler::svc (void)
// Get current time from timer queue since we don't know
// which <gettimeofday> was used.
- ACE_Time_Value cur_time = this->proactor_.timer_queue ()->gettimeofday_abstract ();
+ ACE_Time_Value cur_time =
+ this->proactor_.timer_queue ()->gettimeofday ();
// Compare absolute time with curent time received from the
// timer queue.
@@ -684,7 +685,7 @@ ACE_Proactor::schedule_timer (ACE_Handler &handler,
{
// absolute time.
ACE_Time_Value absolute_time =
- this->timer_queue_->gettimeofday_abstract () + time;
+ this->timer_queue_->gettimeofday () + time;
long result = this->timer_queue_->schedule(&handler, act,
absolute_time, interval);
if (result != -1)
diff --git a/ACE/ace/Select_Reactor_T.cpp b/ACE/ace/Select_Reactor_T.cpp
index aeac6d33cb1..30666cbf11f 100644
--- a/ACE/ace/Select_Reactor_T.cpp
+++ b/ACE/ace/Select_Reactor_T.cpp
@@ -728,7 +728,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_timer
return this->timer_queue_->schedule
(handler,
arg,
- timer_queue_->gettimeofday_abstract () + delay_time,
+ timer_queue_->gettimeofday () + delay_time,
interval);
errno = ESHUTDOWN;
diff --git a/ACE/ace/Timer_Hash_T.cpp b/ACE/ace/Timer_Hash_T.cpp
index 334c93abbf6..c27ff8701f6 100644
--- a/ACE/ace/Timer_Hash_T.cpp
+++ b/ACE/ace/Timer_Hash_T.cpp
@@ -288,8 +288,6 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::ACE_Timer_Hash_T
ACE_NEW (table_,
BUCKET *[table_size]);
- this->gettimeofday (ACE_OS::gettimeofday);
-
for (size_t i = 0;
i < table_size;
++i)
diff --git a/ACE/ace/Timer_Hash_T.h b/ACE/ace/Timer_Hash_T.h
index e2413a7f547..6698520b568 100644
--- a/ACE/ace/Timer_Hash_T.h
+++ b/ACE/ace/Timer_Hash_T.h
@@ -242,7 +242,7 @@ public:
/**
* Run the <functor> for all timers whose values are <=
- * <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. Returns
+ * gettimeofday. Also accounts for <timer_skew>. Returns
* the number of timers canceled.
*/
virtual int expire (void);
diff --git a/ACE/ace/Timer_Queue_Adapters.cpp b/ACE/ace/Timer_Queue_Adapters.cpp
index 634276961a8..b3a2067dc97 100644
--- a/ACE/ace/Timer_Queue_Adapters.cpp
+++ b/ACE/ace/Timer_Queue_Adapters.cpp
@@ -263,8 +263,10 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::svc (void)
{
// Compute the remaining time, being careful not to sleep
// for "negative" amounts of time.
- ACE_Time_Value const tv_curr = this->timer_queue_->gettimeofday_abstract ();
- ACE_Time_Value const tv_earl = this->timer_queue_->earliest_time ();
+ ACE_Time_Value const tv_curr =
+ this->timer_queue_->gettimeofday ();
+ ACE_Time_Value const tv_earl =
+ this->timer_queue_->earliest_time ();
if (tv_earl > tv_curr)
{
diff --git a/ACE/ace/Timer_Queue_T.cpp b/ACE/ace/Timer_Queue_T.cpp
index d4501dc1521..da8a8f75249 100644
--- a/ACE/ace/Timer_Queue_T.cpp
+++ b/ACE/ace/Timer_Queue_T.cpp
@@ -62,9 +62,9 @@ ACE_Timer_Queue_Upcall_Base<TYPE, FUNCTOR>::~ACE_Timer_Queue_Upcall_Base ()
}
template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Time_Value
-ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::gettimeofday_abstract()
+ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::gettimeofday()
{
- return this->gettimeofday();
+ return this->gettimeofday_static();
}
template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Time_Value *
@@ -78,7 +78,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::calculate_timeout (ACE_
return max_wait_time;
else
{
- ACE_Time_Value const cur_time = this->gettimeofday ();
+ ACE_Time_Value const cur_time = this->gettimeofday_static ();
if (this->earliest_time () > cur_time)
{
@@ -123,7 +123,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::calculate_timeout (ACE_
}
else
{
- ACE_Time_Value cur_time = this->gettimeofday ();
+ ACE_Time_Value cur_time = this->gettimeofday_static ();
if (this->earliest_time () > cur_time)
{
@@ -150,7 +150,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::calculate_timeout (ACE_
template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Time_Value
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::current_time()
{
- ACE_Time_Value tv = this->gettimeofday();
+ ACE_Time_Value tv = this->gettimeofday_static ();
tv += this->timer_skew();
return tv;
}
@@ -289,7 +289,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire_single (
return 0;
// Get the current time
- ACE_Time_Value cur_time (this->gettimeofday () +
+ ACE_Time_Value cur_time (this->gettimeofday_static () +
this->timer_skew ());
// Look for a node in the timer queue whose timer <= the present
diff --git a/ACE/ace/Timer_Queue_T.h b/ACE/ace/Timer_Queue_T.h
index 489881fec79..4ba51ffdde0 100644
--- a/ACE/ace/Timer_Queue_T.h
+++ b/ACE/ace/Timer_Queue_T.h
@@ -123,13 +123,13 @@ public:
/**
* Implement the gettimeofday() virtual function
*/
- virtual ACE_Time_Value gettimeofday_abstract (void);
+ virtual ACE_Time_Value gettimeofday (void);
//@}
- /// Implement a non-abstract version of gettimeofday(), through this
- /// member function the internals of the class can make calls to
- /// ACE_OS::gettimeofday() with zero overhead.
- ACE_Time_Value gettimeofday();
+ /// Implement an inlined, non-abstract version of gettimeofday(),
+ /// through this member function the internals of the class can
+ /// make calls to ACE_OS::gettimeofday() with zero overhead.
+ ACE_Time_Value gettimeofday_static();
/// Allows applications to control how the timer queue gets the time
/// of day.
diff --git a/ACE/ace/Timer_Queue_T.inl b/ACE/ace/Timer_Queue_T.inl
index eb3abe53f29..94fdd42d382 100644
--- a/ACE/ace/Timer_Queue_T.inl
+++ b/ACE/ace/Timer_Queue_T.inl
@@ -26,7 +26,7 @@ template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_I
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire (void)
{
if (!this->is_empty ())
- return this->expire (this->gettimeofday () + timer_skew_);
+ return this->expire (this->gettimeofday_static () + timer_skew_);
else
return 0;
}
@@ -79,9 +79,9 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::postinvoke (ACE_Timer_N
}
template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE ACE_Time_Value
-ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::gettimeofday (void)
+ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::gettimeofday_static (void)
{
- // Invoke gettimeofday via pointer to function.
+ // Get the current time according to the time policy.
return this->time_policy_ ();
}
diff --git a/ACE/examples/APG/Timers/TimerDispatcher.cpp b/ACE/examples/APG/Timers/TimerDispatcher.cpp
index 8f8043fbeef..818d762b738 100644
--- a/ACE/examples/APG/Timers/TimerDispatcher.cpp
+++ b/ACE/examples/APG/Timers/TimerDispatcher.cpp
@@ -8,7 +8,7 @@ void Timer_Dispatcher::wait_for_event (void)
while (1)
{
- ACE_Time_Value max_tv = timer_queue_->gettimeofday_abstract ();
+ ACE_Time_Value max_tv = timer_queue_->gettimeofday ();
ACE_Time_Value *this_timeout =
this->timer_queue_->calculate_timeout (&max_tv);
@@ -19,7 +19,7 @@ void Timer_Dispatcher::wait_for_event (void)
{
// Convert to absolute time.
ACE_Time_Value next_timeout =
- timer_queue_->gettimeofday_abstract ();
+ timer_queue_->gettimeofday ();
next_timeout += *this_timeout;
if (this->timer_.wait (&next_timeout) == -1 )
this->timer_queue_->expire ();
diff --git a/ACE/examples/APG/Timers/Timers.cpp b/ACE/examples/APG/Timers/Timers.cpp
index fda76c6afcd..fedc8867a90 100644
--- a/ACE/examples/APG/Timers/Timers.cpp
+++ b/ACE/examples/APG/Timers/Timers.cpp
@@ -40,7 +40,7 @@ int ACE_TMAIN (int, ACE_TCHAR *[])
Timer::instance ()->schedule
(&cb[i],
&args[i],
- timer_queue->gettimeofday_abstract () + ACE_Time_Value(5),
+ timer_queue->gettimeofday () + ACE_Time_Value(5),
timeout);
// Set the timerID state variable of the handler.
diff --git a/ACE/examples/C++NPv2/Logging_Event_Handler_Ex.cpp b/ACE/examples/C++NPv2/Logging_Event_Handler_Ex.cpp
index f27900d955f..858e615e9d9 100644
--- a/ACE/examples/C++NPv2/Logging_Event_Handler_Ex.cpp
+++ b/ACE/examples/C++NPv2/Logging_Event_Handler_Ex.cpp
@@ -9,7 +9,7 @@
int Logging_Event_Handler_Ex::handle_input (ACE_HANDLE h) {
time_of_last_log_record_ =
- reactor ()->timer_queue ()->gettimeofday_abstract ();
+ reactor ()->timer_queue ()->gettimeofday ();
return PARENT::handle_input (h);
}
diff --git a/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp b/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp
index daabfe2aec5..17abcf0827c 100644
--- a/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp
+++ b/ACE/tests/Timer_Queue_Reference_Counting_Test.cpp
@@ -40,7 +40,7 @@ namespace
inline void WAIT_FOR_NEXT_EVENT (ACE_Timer_Queue &timer_queue)
{
ACE_Time_Value const earliest_time = timer_queue.earliest_time ();
- ACE_Time_Value const time_of_day = timer_queue.gettimeofday_abstract ();
+ ACE_Time_Value const time_of_day = timer_queue.gettimeofday ();
if (earliest_time > time_of_day)
{
ACE_OS::sleep (earliest_time - time_of_day);
@@ -155,7 +155,7 @@ cancellation (ACE_Timer_Queue &timer_queue,
first_timer_id =
timer_queue.schedule (handler,
one_second_timeout,
- ACE_Time_Value (1) + timer_queue.gettimeofday_abstract (),
+ ACE_Time_Value (1) + timer_queue.gettimeofday (),
ACE_Time_Value (1));
ACE_ASSERT (first_timer_id != -1);
}
@@ -164,7 +164,7 @@ cancellation (ACE_Timer_Queue &timer_queue,
first_timer_id =
timer_queue.schedule (handler,
one_second_timeout,
- ACE_Time_Value (1) + timer_queue.gettimeofday_abstract ());
+ ACE_Time_Value (1) + timer_queue.gettimeofday ());
ACE_ASSERT (first_timer_id != -1);
}
@@ -173,7 +173,7 @@ cancellation (ACE_Timer_Queue &timer_queue,
second_timer_id =
timer_queue.schedule (handler,
two_second_timeout,
- ACE_Time_Value (2) + timer_queue.gettimeofday_abstract (),
+ ACE_Time_Value (2) + timer_queue.gettimeofday (),
ACE_Time_Value (2));
ACE_ASSERT (second_timer_id != -1);
}
@@ -285,14 +285,14 @@ expire (ACE_Timer_Queue &timer_queue,
long timer_id =
timer_queue.schedule (handler,
one_second_timeout,
- ACE_Time_Value (1) + timer_queue.gettimeofday_abstract (),
+ ACE_Time_Value (1) + timer_queue.gettimeofday (),
ACE_Time_Value (1));
ACE_ASSERT (timer_id != -1);
result =
timer_queue.schedule (handler,
two_second_timeout,
- ACE_Time_Value (2) + timer_queue.gettimeofday_abstract ());
+ ACE_Time_Value (2) + timer_queue.gettimeofday ());
ACE_ASSERT (result != -1);
events += 4;
@@ -421,7 +421,7 @@ simple (ACE_Timer_Queue &timer_queue)
timer_id =
timer_queue.schedule (handler,
one_second_timeout,
- ACE_Time_Value (1) + timer_queue.gettimeofday_abstract (),
+ ACE_Time_Value (1) + timer_queue.gettimeofday (),
ACE_Time_Value (1));
ACE_ASSERT (timer_id != -1);
@@ -439,7 +439,7 @@ simple (ACE_Timer_Queue &timer_queue)
timer_id =
timer_queue.schedule (handler,
one_second_timeout,
- ACE_Time_Value (1) + timer_queue.gettimeofday_abstract (),
+ ACE_Time_Value (1) + timer_queue.gettimeofday (),
ACE_Time_Value (1));
ACE_ASSERT (timer_id != -1);
diff --git a/ACE/tests/Timer_Queue_Test.cpp b/ACE/tests/Timer_Queue_Test.cpp
index 44cf2b81274..359dcf1117e 100644
--- a/ACE/tests/Timer_Queue_Test.cpp
+++ b/ACE/tests/Timer_Queue_Test.cpp
@@ -100,7 +100,7 @@ test_functionality (ACE_Timer_Queue *tq)
long timer_id2;
// Do a test on earliest_time.
- ACE_Time_Value earliest_time = tq->gettimeofday_abstract ();
+ ACE_Time_Value earliest_time = tq->gettimeofday ();
const void *timer_act = 0;
ACE_NEW (timer_act, int (1));
@@ -109,7 +109,7 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_OS::sleep (ACE_Time_Value (0, 10));
ACE_NEW (timer_act, int (1));
- timer_id2 = tq->schedule (&eh, timer_act, tq->gettimeofday_abstract ());
+ timer_id2 = tq->schedule (&eh, timer_act, tq->gettimeofday ());
long result = tq->earliest_time () == earliest_time;
ACE_ASSERT (result != 0);
@@ -125,21 +125,21 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_NEW (timer_act, int (1));
timer_id = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (timer_id != -1);
ACE_ASSERT (tq->is_empty () == 0); //==
ACE_NEW (timer_act, int (42));
result = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (result != -1);
ACE_ASSERT (tq->is_empty () == 0); //==
ACE_NEW (timer_act, int (42));
result = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (result != -1);
ACE_ASSERT (tq->is_empty () == 0); //==
@@ -158,21 +158,21 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_NEW (timer_act, int (007));
result = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (result != -1);
const void *timer_act1 = 0;
ACE_NEW (timer_act1, int (42));
result = tq->schedule (&eh,
timer_act1,
- tq->gettimeofday_abstract () + ACE_Time_Value (100));
+ tq->gettimeofday () + ACE_Time_Value (100));
ACE_ASSERT (result != -1);
const void *timer_act2 = 0;
ACE_NEW (timer_act2, int (42));
result = tq->schedule (&eh,
timer_act2,
- tq->gettimeofday_abstract () + ACE_Time_Value (100));
+ tq->gettimeofday () + ACE_Time_Value (100));
ACE_ASSERT (result != -1);
// The following will trigger a call to <handle_close> when it
@@ -194,13 +194,13 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_NEW (timer_act, int (4));
timer_id = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (timer_id != -1);
ACE_NEW (timer_act, int (4));
timer_id2 = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (timer_id2 != -1);
// The following method will trigger a call to <handle_close>.
@@ -226,7 +226,7 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_NEW (timer_act, int (007));
result = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (result != -1);
result = tq->expire ();
@@ -236,13 +236,13 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_NEW (timer_act, int (6));
timer_id = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (timer_id != -1);
ACE_NEW (timer_act, int (7));
timer_id2 = tq->schedule (&eh,
timer_act,
- tq->gettimeofday_abstract ());
+ tq->gettimeofday ());
ACE_ASSERT (timer_id2 != -1);
ACE_ASSERT (eh.close_count_ == 3);
@@ -282,7 +282,7 @@ test_performance (ACE_Timer_Queue *tq,
// Set up a bunch of times TIMER_DISTANCE ms apart.
for (i = 0; i < max_iterations; ++i)
{
- times[i] = (tq->gettimeofday_abstract()
+ times[i] = (tq->gettimeofday()
+ ACE_Time_Value(0, i * TIMER_DISTANCE * 1000));
}