summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-06-21 01:12:43 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-06-21 01:12:43 +0000
commitb5a972bd3eafea8e44374135c092d2653b103c69 (patch)
treea96ddac6d4e08a6c22849da0c158b72a73be6b9e
parentccd25fefe4bac76684b583faa121bfaeab0dfdfe (diff)
downloadATCD-b5a972bd3eafea8e44374135c092d2653b103c69.tar.gz
*** empty log message ***
-rw-r--r--ace/Reactor_Impl.h15
-rw-r--r--ace/Select_Reactor.cpp33
-rw-r--r--ace/Select_Reactor.h50
-rw-r--r--ace/Select_Reactor.i5
-rw-r--r--ace/WFMO_Reactor.h2
5 files changed, 65 insertions, 40 deletions
diff --git a/ace/Reactor_Impl.h b/ace/Reactor_Impl.h
index a47bea9aa5d..863ca0f2736 100644
--- a/ace/Reactor_Impl.h
+++ b/ace/Reactor_Impl.h
@@ -61,6 +61,21 @@ public:
const ACE_Handle_Set &rd_mask) = 0;
// Handles pending threads (if any) that are waiting to unblock the
// <Reactor_Impl>.
+
+ virtual void max_notify_iterations (int) = 0;
+ // Set the maximum number of times that the <handle_input> method
+ // will iterate and dispatch the <ACE_Event_Handlers> that are
+ // passed in via the notify queue before breaking out of the event
+ // loop. By default, this is set to -1, which means "iterate until
+ // the queue is empty." Setting this to a value like "1 or 2" will
+ // increase "fairness" (and thus prevent starvation) at the expense
+ // of slightly higher dispatching overhead.
+
+ virtual int max_notify_iterations (void) = 0;
+ // Get the maximum number of times that the <handle_input> method
+ // will iterate and dispatch the <ACE_Event_Handlers> that are
+ // passed in via the notify queue before breaking out of its event
+ // loop.
};
class ACE_Export ACE_Reactor_Impl
diff --git a/ace/Select_Reactor.cpp b/ace/Select_Reactor.cpp
index 21c08c9de28..9d2f5095c53 100644
--- a/ace/Select_Reactor.cpp
+++ b/ace/Select_Reactor.cpp
@@ -541,11 +541,7 @@ ACE_Select_Reactor::max_notify_iterations (int iterations)
ACE_TRACE ("ACE_Select_Reactor::max_notify_iterations");
ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_MUTEX, ace_mon, this->token_));
- // Must always be > 0 or < 0 to optimize the loop exit condition.
- if (iterations == 0)
- iterations = 1;
-
- this->max_notify_iterations_ = iterations;
+ this->notify_handler_->max_notify_iterations (iterations);
}
int
@@ -553,7 +549,7 @@ ACE_Select_Reactor::max_notify_iterations (void)
{
ACE_TRACE ("ACE_Select_Reactor::max_notify_iterations");
ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_MUTEX, ace_mon, this->token_, -1));
- return this->max_notify_iterations_;
+ return this->notify_handler_->max_notify_iterations ();
}
// Enqueue ourselves into the list of waiting threads.
@@ -627,6 +623,27 @@ ACE_Select_Reactor_Token::sleep_hook (void)
#endif /* ACE_MT_SAFE */
+ACE_Select_Reactor_Notify::ACE_Select_Reactor_Notify (void)
+ : max_notify_iterations_ (-1)
+{
+}
+
+void
+ACE_Select_Reactor_Notify::max_notify_iterations (int iterations)
+{
+ // Must always be > 0 or < 0 to optimize the loop exit condition.
+ if (iterations == 0)
+ iterations = 1;
+
+ this->max_notify_iterations_ = iterations;
+}
+
+int
+ACE_Select_Reactor_Notify::max_notify_iterations (int iterations)
+{
+ return this->max_notify_iterations_;
+}
+
void
ACE_Select_Reactor_Notify::dump (void) const
{
@@ -799,7 +816,7 @@ ACE_Select_Reactor_Notify::handle_input (ACE_HANDLE handle)
// Bail out if we've reached the <notify_threshold_>. Note that
// by default <notify_threshold_> is -1, so we'll loop until all
// the notifications in the pipe have been dispatched.
- if (number_dispatched == this->select_reactor_->max_notify_iterations_)
+ if (number_dispatched == this->max_notify_iterations_)
break;
}
@@ -1071,7 +1088,6 @@ ACE_Select_Reactor::ACE_Select_Reactor (ACE_Sig_Handler *sh,
delete_signal_handler_ (0),
delete_notify_handler_ (0),
requeue_position_ (-1), // Requeue at end of waiters by default.
- max_notify_iterations_ (-1),
initialized_ (0),
state_changed_ (0),
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
@@ -1107,7 +1123,6 @@ ACE_Select_Reactor::ACE_Select_Reactor (size_t size,
delete_signal_handler_ (0),
delete_notify_handler_ (0),
requeue_position_ (-1), // Requeue at end of waiters by default.
- max_notify_iterations_ (-1),
initialized_ (0),
state_changed_ (0),
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
diff --git a/ace/Select_Reactor.h b/ace/Select_Reactor.h
index 3bc153ad374..66ca3a73f5f 100644
--- a/ace/Select_Reactor.h
+++ b/ace/Select_Reactor.h
@@ -208,6 +208,22 @@ public:
// Called back by the <ACE_Select_Reactor> when a thread wants to
// unblock us.
+ virtual void max_notify_iterations (int);
+ // Set the maximum number of times that the
+ // <ACE_Select_Reactor_Notify::handle_input> method will iterate and
+ // dispatch the <ACE_Event_Handlers> that are passed in via the
+ // notify pipe before breaking out of its <recv> loop. By default,
+ // this is set to -1, which means "iterate until the pipe is empty."
+ // Setting this to a value like "1 or 2" will increase "fairness"
+ // (and thus prevent starvation) at the expense of slightly higher
+ // dispatching overhead.
+
+ virtual int max_notify_iterations (void);
+ // Get the maximum number of times that the
+ // <ACE_Select_Reactor_Notify::handle_input> method will iterate and
+ // dispatch the <ACE_Event_Handlers> that are passed in via the
+ // notify pipe before breaking out of its <recv> loop.
+
void dump (void) const;
// Dump the state of an object.
@@ -224,6 +240,13 @@ private:
// Contains the <ACE_HANDLE> the <ACE_Select_Reactor> is listening
// on, as well as the <ACE_HANDLE> that threads wanting the
// attention of the <ACE_Select_Reactor> will write to.
+
+ int max_notify_iterations_;
+ // Keeps track of the maximum number of times that the
+ // <ACE_Select_Reactor_Notify::handle_input> method will iterate and
+ // dispatch the <ACE_Event_Handlers> that are passed in via the
+ // notify pipe before breaking out of its <recv> loop. By default,
+ // this is set to -1, which means "iterate until the pipe is empty."
};
class ACE_Export ACE_Select_Reactor_Handler_Repository
@@ -655,22 +678,6 @@ public:
// Get position that the main ACE_Select_Reactor thread is requeued in the
// list of waiters during a notify() callback.
- virtual void max_notify_iterations (int);
- // Set the maximum number of times that the
- // <ACE_Select_Reactor_Notify::handle_input> method will iterate and
- // dispatch the <ACE_Event_Handlers> that are passed in via the
- // notify pipe before breaking out of its <recv> loop. By default,
- // this is set to -1, which means "iterate until the pipe is empty."
- // Setting this to a value like "1 or 2" will increase "fairness"
- // (and thus prevent starvation) at the expense of slightly higher
- // dispatching overhead.
-
- virtual int max_notify_iterations (void);
- // Get the maximum number of times that the
- // <ACE_Select_Reactor_Notify::handle_input> method will iterate and
- // dispatch the <ACE_Event_Handlers> that are passed in via the
- // notify pipe before breaking out of its <recv> loop.
-
// = Low-level wait_set mask manipulation methods.
virtual int mask_ops (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask,
@@ -865,8 +872,8 @@ protected:
// Keeps track of whether we should delete the signal handler (if we
// didn't create it, then we don't delete it).
- ACE_Select_Reactor_Notify *notify_handler_;
- // Callback object that unblocks the ACE_Select_Reactor if it's
+ ACE_Reactor_Notify *notify_handler_;
+ // Callback object that unblocks the <ACE_Select_Reactor> if it's
// sleeping.
int delete_notify_handler_;
@@ -893,13 +900,6 @@ protected:
// we are requeued at the front of the list. Else if it's > 1 then
// that indicates the number of waiters to skip over.
- int max_notify_iterations_;
- // Keeps track of the maximum number of times that the
- // <ACE_Select_Reactor_Notify::handle_input> method will iterate and
- // dispatch the <ACE_Event_Handlers> that are passed in via the
- // notify pipe before breaking out of its <recv> loop. By default,
- // this is set to -1, which means "iterate until the pipe is empty."
-
int initialized_;
// True if we've been initialized yet...
diff --git a/ace/Select_Reactor.i b/ace/Select_Reactor.i
index 6cfc2738585..57d5fb6b58a 100644
--- a/ace/Select_Reactor.i
+++ b/ace/Select_Reactor.i
@@ -9,11 +9,6 @@ ACE_Event_Tuple::~ACE_Event_Tuple (void)
}
ACE_INLINE
-ACE_Select_Reactor_Notify::ACE_Select_Reactor_Notify (void)
-{
-}
-
-ACE_INLINE
ACE_Select_Reactor_Notify::~ACE_Select_Reactor_Notify (void)
{
}
diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h
index 8115f5170e8..38acbdd3899 100644
--- a/ace/WFMO_Reactor.h
+++ b/ace/WFMO_Reactor.h
@@ -981,7 +981,7 @@ protected:
int delete_handler_rep_;
// Keeps track of whether we should delete the handler repository
- ACE_WFMO_Reactor_Notify *notify_handler_;
+ ACE_Reactor_Notify *notify_handler_;
// Used when <notify> is called.
int delete_notify_handler_;