summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-26 01:51:45 +0000
committerharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-26 01:51:45 +0000
commite250aca027bddd4ef3a5f1bfba7d6070c5d193e5 (patch)
tree7fcc1803062ca5c223c3b5003c677b1d9219c6e6
parent32148192252ebe808406cdce97b89dc33f783aab (diff)
downloadATCD-e250aca027bddd4ef3a5f1bfba7d6070c5d193e5.tar.gz
Reactors now call Timer_Queue::gettimeofday. Timer_Queue takes a
gettimeofday strategy (pointer to function).
-rw-r--r--ace/ReactorEx.cpp19
-rw-r--r--ace/ReactorEx.h8
-rw-r--r--ace/Timer_Queue.cpp14
-rw-r--r--ace/Timer_Queue.h7
4 files changed, 21 insertions, 27 deletions
diff --git a/ace/ReactorEx.cpp b/ace/ReactorEx.cpp
index 1f796413fc8..8dea9eec220 100644
--- a/ace/ReactorEx.cpp
+++ b/ace/ReactorEx.cpp
@@ -508,23 +508,10 @@ ACE_ReactorEx::handle_events (ACE_Time_Value *max_wait_time,
int wait_status = this->wait_for_multiple_events (max_wait_time,
alertable);
- result = this->safe_dispatch (wait_status);
- return result;
-}
-
-int
-ACE_ReactorEx::safe_dispatch (int wait_status)
-{
- int result;
- ACE_SEH_TRY
- {
- result = this->dispatch (wait_status);
- }
- ACE_SEH_FINALLY
- {
- this->update_state ();
- }
+ result = this->dispatch (wait_status);
+
+ this->update_state ();
return result;
}
diff --git a/ace/ReactorEx.h b/ace/ReactorEx.h
index 270a4f3263b..f7bb533c4a1 100644
--- a/ace/ReactorEx.h
+++ b/ace/ReactorEx.h
@@ -227,9 +227,6 @@ private:
// -1, which means "iterate until the queue is empty."
};
-class ACE_ReactorEx_Test;
-// Forward declaration
-
#if defined (ACE_WIN32)
class ACE_Export ACE_ReactorEx
// = TITLE
@@ -244,7 +241,6 @@ class ACE_Export ACE_ReactorEx
// semaphores, threads, etc.) and timer events.
{
friend class ACE_ReactorEx_Handler_Repository;
- friend class ACE_ReactorEx_Test;
public:
enum
{
@@ -443,10 +439,6 @@ private:
ACE_ReactorEx &operator = (const ACE_ReactorEx &);
// Deny access since member-wise won't work...
- int safe_dispatch (int wait_status);
- // Protect against structured exceptions caused by user code when
- // dispatching handles
-
int calculate_timeout (ACE_Time_Value *time);
// Used to caluculate the next timeout
diff --git a/ace/Timer_Queue.cpp b/ace/Timer_Queue.cpp
index 738ea7a4263..8b174434ac8 100644
--- a/ace/Timer_Queue.cpp
+++ b/ace/Timer_Queue.cpp
@@ -109,8 +109,8 @@ ACE_Timer_Queue::dump (void) const
}
ACE_Timer_Queue::ACE_Timer_Queue (void)
- : timer_skew_ (0, ACE_TIMER_SKEW)
-
+ : timer_skew_ (0, ACE_TIMER_SKEW),
+ gettimeofday_ (ACE_OS::gettimeofday)
{
ACE_TRACE ("ACE_Timer_Queue::ACE_Timer_Queue");
}
@@ -177,5 +177,13 @@ ACE_Timer_Queue::expire (const ACE_Time_Value &cur_time)
ACE_Time_Value
ACE_Timer_Queue::gettimeofday (void)
{
- return ACE_OS::gettimeofday ();
+ // Invoke gettimeofday via pointer to function.
+ return gettimeofday_ ();
+}
+
+void
+ACE_Timer_Queue::gettimeofday (ACE_Time_Value (*gettimeofday)(void))
+{
+ gettimeofday_ = gettimeofday;
}
+
diff --git a/ace/Timer_Queue.h b/ace/Timer_Queue.h
index 37df0367d25..5aa61b1ed0f 100644
--- a/ace/Timer_Queue.h
+++ b/ace/Timer_Queue.h
@@ -177,6 +177,10 @@ public:
// implementations of the timer queue to use special high resolution
// timers.
+ void gettimeofday (ACE_Time_Value (*gettimeofday)(void));
+ // Allows applications to control how the timer queue gets the time
+ // of day.
+
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.
@@ -209,6 +213,9 @@ protected:
// Synchronization variable for the MT_SAFE ACE_Reactor
#endif /* ACE_MT_SAFE */
+ ACE_Time_Value (*gettimeofday_)(void);
+ // Pointer to function that returns the current time of day.
+
private:
ACE_Time_Value timeout_;
// Returned by <calculate_timeout>.