summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-19 23:25:59 +0000
committerharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-19 23:25:59 +0000
commit180512fd85416df0d71221099129fdafa69740d6 (patch)
tree2310a074fce53fac82638d603e29c645991e40b5
parentdb84063539b4934bf8d8699f6c9f1f75703a8930 (diff)
downloadATCD-180512fd85416df0d71221099129fdafa69740d6.tar.gz
Added Timer_Queue::gettimeofday.
-rw-r--r--ace/Proactor.cpp2
-rw-r--r--ace/Reactor.cpp2
-rw-r--r--ace/ReactorEx.cpp13
-rw-r--r--ace/ReactorEx.h9
-rw-r--r--ace/Timer_Queue.cpp7
-rw-r--r--ace/Timer_Queue.h5
-rw-r--r--ace/Timer_Queue.i2
7 files changed, 28 insertions, 12 deletions
diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp
index 2770de84df1..313f4086d9a 100644
--- a/ace/Proactor.cpp
+++ b/ace/Proactor.cpp
@@ -245,7 +245,7 @@ ACE_Proactor::schedule_timer (ACE_Event_Handler *handler,
ACE_TRACE ("ACE_Proactor::schedule_timer");
return this->timer_queue_->schedule
- (handler, arg, ACE_OS::gettimeofday () + delta_time, interval);
+ (handler, arg, timer_queue_->gettimeofday () + delta_time, interval);
}
#define ACE_TIMEOUT_OCCURRED 258
diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp
index a245502d448..af44d2e4438 100644
--- a/ace/Reactor.cpp
+++ b/ace/Reactor.cpp
@@ -1078,7 +1078,7 @@ ACE_Reactor::schedule_timer (ACE_Event_Handler *handler,
ACE_MT (ACE_GUARD_RETURN (ACE_REACTOR_MUTEX, ace_mon, this->token_, -1));
return this->timer_queue_->schedule
- (handler, arg, ACE_OS::gettimeofday () + delta_time, interval);
+ (handler, arg, timer_queue_->gettimeofday () + delta_time, interval);
}
// Main event loop driver that blocks for <max_wait_time> before
diff --git a/ace/ReactorEx.cpp b/ace/ReactorEx.cpp
index 91750626aee..8dea9eec220 100644
--- a/ace/ReactorEx.cpp
+++ b/ace/ReactorEx.cpp
@@ -346,7 +346,7 @@ ACE_ReactorEx::open (size_t size,
this->delete_handler_rep_ = 1;
// Open the notification handler
- if (this->notify_handler_.open (*this) == -1)
+ if (this->notify_handler_.open (*this, timer_queue_) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
"opening notify handler "),
-1);
@@ -464,7 +464,7 @@ ACE_ReactorEx::schedule_timer (ACE_Event_Handler *handler,
ACE_TRACE ("ACE_ReactorEx::schedule_timer");
int result = this->timer_queue_->schedule
- (handler, arg, ACE_OS::gettimeofday () + delta_time, interval);
+ (handler, arg, timer_queue_->gettimeofday () + delta_time, interval);
// Wakeup the owner thread so that it gets the latest timer values
this->notify ();
@@ -733,13 +733,16 @@ ACE_ReactorEx::update_state (void)
// ************************************************************
ACE_ReactorEx_Notify::ACE_ReactorEx_Notify (void)
- : max_notify_iterations_ (-1)
+ : max_notify_iterations_ (-1),
+ timer_queue_ (0)
{
}
int
-ACE_ReactorEx_Notify::open (ACE_ReactorEx &reactorEx)
+ACE_ReactorEx_Notify::open (ACE_ReactorEx &reactorEx,
+ ACE_Timer_Queue *timer_queue)
{
+ timer_queue_ = timer_queue;
return reactorEx.register_handler (this);
}
@@ -849,7 +852,7 @@ ACE_ReactorEx_Notify::notify (ACE_Event_Handler *eh,
// current time of day. This is what <ACE_Message_Queue>
// expects.
if (timeout != 0)
- *timeout += ACE_OS::gettimeofday ();
+ *timeout += timer_queue_->gettimeofday ();
if (this->message_queue_.enqueue_tail
(mb, timeout) == -1)
diff --git a/ace/ReactorEx.h b/ace/ReactorEx.h
index 5b570e9b995..f7bb533c4a1 100644
--- a/ace/ReactorEx.h
+++ b/ace/ReactorEx.h
@@ -32,7 +32,6 @@ class ACE_Export ACE_Wakeup_All_Threads_Handler : public ACE_Event_Handler
// on <ACE_ReactorEx->wakeup_all_threads_>
{
public:
-
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
// Called when the <ACE_ReactorEx->wakeup_all_threads_>
@@ -163,8 +162,9 @@ public:
ACE_ReactorEx_Notify (void);
// Constructor
- int open (ACE_ReactorEx &reactorEx);
- // Initialization
+ int open (ACE_ReactorEx &reactorEx,
+ ACE_Timer_Queue *timer_queue);
+ // Initialization. <timer_queue> is stored to call gettimeofday.
int notify (ACE_Event_Handler *eh = 0,
ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
@@ -199,6 +199,9 @@ public:
// <ACE_Message_Queue::dequeue> loop.
private:
+ ACE_Timer_Queue *timer_queue_;
+ // Pointer to the reactor's timer queue.
+
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
// Called when the notification event waited on by <ACE_ReactorEx>
// is signaled. This dequeues all pending <ACE_Event_Handlers> and
diff --git a/ace/Timer_Queue.cpp b/ace/Timer_Queue.cpp
index a3aa4e7a200..8de4bbd281e 100644
--- a/ace/Timer_Queue.cpp
+++ b/ace/Timer_Queue.cpp
@@ -72,7 +72,7 @@ ACE_Timer_Queue::calculate_timeout (ACE_Time_Value *max_wait_time)
return max_wait_time;
else
{
- ACE_Time_Value cur_time = ACE_OS::gettimeofday ();
+ ACE_Time_Value cur_time = this->gettimeofday ();
if (this->earliest_time () > cur_time)
{
@@ -174,3 +174,8 @@ ACE_Timer_Queue::expire (const ACE_Time_Value &cur_time)
return number_of_timers_expired;
}
+ACE_Time_Value
+ACE_Timer_Queue::gettimeofday (void)
+{
+ return ACE_OS::gettimeofday ();
+}
diff --git a/ace/Timer_Queue.h b/ace/Timer_Queue.h
index f14c6f798e0..37df0367d25 100644
--- a/ace/Timer_Queue.h
+++ b/ace/Timer_Queue.h
@@ -172,6 +172,11 @@ public:
// Returns the number of <Event_Handler>s for which <handle_timeout>
// was called.
+ virtual ACE_Time_Value gettimeofday (void);
+ // Returns the current time of day. This allows different
+ // implementations of the timer queue to use special high resolution
+ // timers.
+
virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max);
// Determine the next event to timeout. Returns <max> if there are
// no pending timers or if all pending timers are longer than max.
diff --git a/ace/Timer_Queue.i b/ace/Timer_Queue.i
index 480103b0062..d944a83edc4 100644
--- a/ace/Timer_Queue.i
+++ b/ace/Timer_Queue.i
@@ -19,7 +19,7 @@ ACE_INLINE int
ACE_Timer_Queue::expire (void)
{
if (!this->is_empty ())
- return this->expire (ACE_OS::gettimeofday () + timer_skew_);
+ return this->expire (this->gettimeofday () + timer_skew_);
else
return 0;
}