summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/local/ChangeLog73
-rw-r--r--TAO/local/Makefile23
-rw-r--r--TAO/local/README2
-rw-r--r--TAO/local/bin/Event_Service/BCU.cpp31
-rw-r--r--TAO/local/bin/Event_Service/BCU.h35
-rw-r--r--TAO/local/bin/Event_Service/CORBA_Utils_T.cpp349
-rw-r--r--TAO/local/bin/Event_Service/CORBA_Utils_T.h236
-rw-r--r--TAO/local/bin/Event_Service/CORBA_Utils_T.i70
-rw-r--r--TAO/local/bin/Event_Service/Channel_Clients.i2
-rw-r--r--TAO/local/bin/Event_Service/Channel_Clients_T.i35
-rw-r--r--TAO/local/bin/Event_Service/Debug_Macros.h11
-rw-r--r--TAO/local/bin/Event_Service/Dispatching_Modules.cpp603
-rw-r--r--TAO/local/bin/Event_Service/Dispatching_Modules.h484
-rw-r--r--TAO/local/bin/Event_Service/Dispatching_Modules.i267
-rw-r--r--TAO/local/bin/Event_Service/Event_Channel.cpp2986
-rw-r--r--TAO/local/bin/Event_Service/Event_Channel.h1366
-rw-r--r--TAO/local/bin/Event_Service/Event_Channel.i914
-rw-r--r--TAO/local/bin/Event_Service/Event_Service.cpp82
-rw-r--r--TAO/local/bin/Event_Service/Fast_Reactor.h49
-rw-r--r--TAO/local/bin/Event_Service/GPlot_File.cpp171
-rw-r--r--TAO/local/bin/Event_Service/GPlot_File.h96
-rw-r--r--TAO/local/bin/Event_Service/GPlot_File.i70
-rw-r--r--TAO/local/bin/Event_Service/Local_ESTypes.cpp9
-rw-r--r--TAO/local/bin/Event_Service/Local_ESTypes.h62
-rw-r--r--TAO/local/bin/Event_Service/Local_ESTypes.i5
-rw-r--r--TAO/local/bin/Event_Service/Makefile1226
-rw-r--r--TAO/local/bin/Event_Service/Memory_Pools.cpp33
-rw-r--r--TAO/local/bin/Event_Service/Memory_Pools.h104
-rw-r--r--TAO/local/bin/Event_Service/Memory_Pools.i54
-rw-r--r--TAO/local/bin/Event_Service/RT_Task.cpp357
-rw-r--r--TAO/local/bin/Event_Service/RT_Task.h179
-rw-r--r--TAO/local/bin/Event_Service/RT_Task.i8
-rw-r--r--TAO/local/bin/Event_Service/ReactorTask.cpp107
-rw-r--r--TAO/local/bin/Event_Service/ReactorTask.h77
-rw-r--r--TAO/local/bin/Event_Service/Task_Manager.cpp37
-rw-r--r--TAO/local/bin/Event_Service/Task_Manager.h56
-rw-r--r--TAO/local/bin/Event_Service/Task_Manager.i30
-rw-r--r--TAO/local/bin/Makefile23
-rw-r--r--TAO/local/bin/Scheduling_Service/.cvsignore3
-rw-r--r--TAO/local/bin/Scheduling_Service/Config_Scheduler.cpp256
-rw-r--r--TAO/local/bin/Scheduling_Service/Config_Scheduler.h94
-rw-r--r--TAO/local/bin/Scheduling_Service/Config_Scheduler.i5
-rw-r--r--TAO/local/bin/Scheduling_Service/Makefile752
-rw-r--r--TAO/local/bin/Scheduling_Service/Scheduler.cpp291
-rw-r--r--TAO/local/bin/Scheduling_Service/Scheduler.h278
-rw-r--r--TAO/local/bin/Scheduling_Service/Scheduler.i20
-rw-r--r--TAO/local/bin/Scheduling_Service/Scheduler_Internal.cpp2332
-rw-r--r--TAO/local/bin/Scheduling_Service/Scheduler_Internal.h252
-rw-r--r--TAO/local/bin/Scheduling_Service/Scheduler_Internal.i21
-rw-r--r--TAO/local/bin/Scheduling_Service/dump_schedule.cpp67
-rw-r--r--TAO/local/bin/Scheduling_Service/schedule_service.cpp71
-rw-r--r--TAO/local/bin/Scheduling_Service/svc.conf49
-rw-r--r--TAO/local/tests/Latency.cpp756
-rw-r--r--TAO/local/tests/Latency.h191
-rw-r--r--TAO/local/tests/Makefile262
-rw-r--r--TAO/local/tests/Utilization.cpp871
-rw-r--r--TAO/local/tests/Utilization.h182
57 files changed, 17075 insertions, 0 deletions
diff --git a/TAO/local/ChangeLog b/TAO/local/ChangeLog
new file mode 100644
index 00000000000..c9f15a8d797
--- /dev/null
+++ b/TAO/local/ChangeLog
@@ -0,0 +1,73 @@
+Sun Nov 16 00:11:28 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
+
+ * README:
+ * Makefile:
+ This directory should hold the propietary code of Boeing. It
+ even holds its own Makefile to keep the profile *very* low.
+ IT MUST NOT BE DISTRIBUTED IN THE RELEASES.
+
+ * bin/Makefile:
+ This directory contains the Services (Event and Schedule).
+
+ * bin/Scheduling_Service/Makefile:
+ * bin/Scheduling_Service/.cvsignore:
+ * bin/Scheduling_Service/svc.conf:
+ * bin/Scheduling_Service/Config_Scheduler.cpp:
+ * bin/Scheduling_Service/Config_Scheduler.h:
+ * bin/Scheduling_Service/Config_Scheduler.i:
+ * bin/Scheduling_Service/Scheduler.cpp:
+ * bin/Scheduling_Service/Scheduler.h:
+ * bin/Scheduling_Service/Scheduler.i:
+ * bin/Scheduling_Service/Scheduler_Internal.cpp:
+ * bin/Scheduling_Service/Scheduler_Internal.h:
+ * bin/Scheduling_Service/Scheduler_Internal.i:
+ * bin/Scheduling_Service/dump_schedule.cpp:
+ * bin/Scheduling_Service/schedule_service.cpp:
+ This is the implementation of the Scheduling Service.
+ The dump utility is also here, in the future we may want to move
+ it.
+
+ * bin/Event_Service/Makefile:
+ * bin/Event_Service/BCU.cpp:
+ * bin/Event_Service/BCU.h:
+ * bin/Event_Service/CORBA_Utils_T.cpp:
+ * bin/Event_Service/CORBA_Utils_T.h:
+ * bin/Event_Service/CORBA_Utils_T.i:
+ * bin/Event_Service/Channel_Clients.i:
+ * bin/Event_Service/Channel_Clients_T.i:
+ * bin/Event_Service/Debug_Macros.h:
+ * bin/Event_Service/Dispatching_Modules.cpp:
+ * bin/Event_Service/Dispatching_Modules.h:
+ * bin/Event_Service/Dispatching_Modules.i:
+ * bin/Event_Service/Event_Channel.cpp:
+ * bin/Event_Service/Event_Channel.h:
+ * bin/Event_Service/Event_Channel.i:
+ * bin/Event_Service/Event_Service.cpp:
+ * bin/Event_Service/Fast_Reactor.h:
+ * bin/Event_Service/GPlot_File.cpp:
+ * bin/Event_Service/GPlot_File.h:
+ * bin/Event_Service/GPlot_File.i:
+ * bin/Event_Service/Local_ESTypes.cpp:
+ * bin/Event_Service/Local_ESTypes.h:
+ * bin/Event_Service/Local_ESTypes.i:
+ * bin/Event_Service/Memory_Pools.cpp:
+ * bin/Event_Service/Memory_Pools.h:
+ * bin/Event_Service/Memory_Pools.i:
+ * bin/Event_Service/RT_Task.cpp:
+ * bin/Event_Service/RT_Task.h:
+ * bin/Event_Service/RT_Task.i:
+ * bin/Event_Service/ReactorTask.cpp:
+ * bin/Event_Service/ReactorTask.h:
+ * bin/Event_Service/Task_Manager.cpp:
+ * bin/Event_Service/Task_Manager.h:
+ * bin/Event_Service/Task_Manager.i:
+ Implements the Event Service.
+
+ * tests/Makefile:
+ * tests/Latency.cpp:
+ * tests/Latency.h:
+ * tests/Utilization.cpp:
+ * tests/Utilization.h:
+ Simple tests for the Event Service.
+
+
diff --git a/TAO/local/Makefile b/TAO/local/Makefile
new file mode 100644
index 00000000000..658bbefe555
--- /dev/null
+++ b/TAO/local/Makefile
@@ -0,0 +1,23 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+DIRS = bin \
+ tests
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU
+
diff --git a/TAO/local/README b/TAO/local/README
new file mode 100644
index 00000000000..f556fcac4da
--- /dev/null
+++ b/TAO/local/README
@@ -0,0 +1,2 @@
+This directory should contain the non-distributable code for TAO, such
+as the Boeing propietary stuff.
diff --git a/TAO/local/bin/Event_Service/BCU.cpp b/TAO/local/bin/Event_Service/BCU.cpp
new file mode 100644
index 00000000000..862f6240cdc
--- /dev/null
+++ b/TAO/local/bin/Event_Service/BCU.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "BCU.h"
+#include "ace/ACE.h"
+
+
+u_long
+ACE_BCU (u_long n)
+{
+ const u_long ACE_BCU_PRIME_NUMBER = 9619;
+
+ u_long retval = 0;
+
+ while (n-- > 0)
+ retval = ACE::is_prime (ACE_BCU_PRIME_NUMBER, 2, ACE_BCU_PRIME_NUMBER / 2);
+
+ return retval;
+}
+
+
+u_long
+ACE_BCU (u_long number,
+ u_long n)
+{
+ u_long retval = 0;
+
+ while (n-- > 0)
+ retval = ACE::is_prime (number, 2, number);
+
+ return retval;
+}
diff --git a/TAO/local/bin/Event_Service/BCU.h b/TAO/local/bin/Event_Service/BCU.h
new file mode 100644
index 00000000000..9eaf5fdf96b
--- /dev/null
+++ b/TAO/local/bin/Event_Service/BCU.h
@@ -0,0 +1,35 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ace ORB
+//
+// = FILENAME
+// Benchmark Computation Units
+//
+// = AUTHOR
+// David Levine and Tim Harrison (harrison@cs.wustl.edu)
+//
+// = DESCRIPTION
+//
+// Times how long it takes to generate each of the first N prime
+// numbers.
+// ============================================================================
+
+#if !defined (ACE_BCU_H)
+#define ACE_BCU_H
+
+#include "ace/OS.h"
+
+
+u_long ACE_BCU (u_long n);
+// Check if a specific, hardcoded number is prime (via ACE::is_prime) <n>
+// times.
+
+
+u_long ACE_BCU (u_long number, u_long n);
+// Check if <number> is prime (via ACE::is_prime ()) <n> times.
+
+#endif /* ACE_BCU_H */
diff --git a/TAO/local/bin/Event_Service/CORBA_Utils_T.cpp b/TAO/local/bin/Event_Service/CORBA_Utils_T.cpp
new file mode 100644
index 00000000000..f603421eaaa
--- /dev/null
+++ b/TAO/local/bin/Event_Service/CORBA_Utils_T.cpp
@@ -0,0 +1,349 @@
+// $Id$
+
+#if !defined (ACE_CORBA_UTILS_C)
+#define ACE_CORBA_UTILS_C
+
+#include "CORBA_Utils_T.h"
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+#include "CORBA_Utils_T.i"
+#endif /* __ACE_INLINE__ */
+
+template <class TYPE>
+ACE_CORBA_Sequence<TYPE>::ACE_CORBA_Sequence (const ACE_CORBA_Sequence<TYPE> &source)
+ : maximum_ (0),
+ length_ (0),
+ buffer_ (0),
+ release_ (0)
+{
+ (*this) = source;
+}
+
+template <class TYPE>
+ACE_CORBA_Sequence<TYPE>::ACE_CORBA_Sequence (void)
+ : maximum_ (0),
+ length_ (0),
+ buffer_ (0),
+ release_ (0)
+{
+}
+
+template <class TYPE>
+ACE_CORBA_Sequence<TYPE>::~ACE_CORBA_Sequence (void)
+{
+ if (release_)
+ {
+ this->delete_array (buffer_, maximum_);
+ }
+}
+
+template <class TYPE>
+ACE_CORBA_Sequence<TYPE>::ACE_CORBA_Sequence (CORBA::ULong max)
+ : maximum_ (max),
+ length_ (0),
+ buffer_ (0),
+
+ release_ (0)
+{
+ if (maximum_ > 0)
+ {
+ buffer_ = this->new_array (maximum_);
+ release_ = 1;
+ }
+}
+
+template <class TYPE> TYPE *
+ACE_CORBA_Sequence<TYPE>::new_array (size_t len)
+{
+ return new TYPE[len];
+}
+
+template <class TYPE> void
+ACE_CORBA_Sequence<TYPE>::delete_array (TYPE *buf, size_t)
+{
+ delete [] buf;
+}
+
+template <class TYPE>
+ACE_CORBA_Sequence<TYPE>::ACE_CORBA_Sequence (CORBA::ULong max,
+ CORBA::ULong length,
+ TYPE* data,
+ CORBA::Boolean release)
+ : maximum_ (max),
+ length_ (length),
+ buffer_ (data),
+ release_ (release)
+{
+ if ((buffer_ == 0) && (max > 0))
+ {
+ // @@ What should we do here?
+ errno = ENOMEM;
+ ACE_ERROR ((LM_ERROR, "No memory.\n"));
+ }
+}
+
+// @@ This makes a deep copy, dig?
+template <class TYPE> ACE_CORBA_Sequence<TYPE> &
+ACE_CORBA_Sequence<TYPE>::operator= (const ACE_CORBA_Sequence<TYPE> &source)
+{
+ if (source.length () > 0)
+ {
+ // If our buffer is too small, release it and allocate one just big
+ // enough. If buffer_ == 0, this works fine.
+ if (this->maximum () < source.length ())
+ {
+ if (release_)
+ {
+ this->delete_array (buffer_, maximum_);
+ }
+ maximum_ = source.length ();
+ buffer_ = this->new_array (maximum_);
+ release_ = 1;
+ }
+
+ // Copy each of the items from the source.
+ for (CORBA::ULong index=0; index < source.length (); index++)
+ (*this)[index] = source[index];
+
+ this->length (source.length ());
+ }
+
+ return *this;
+}
+
+template <class TYPE> void
+ACE_CORBA_Sequence<TYPE>::length (CORBA::ULong len)
+{
+ if (len > maximum_)
+ {
+ // Allocate the space that we need.
+ TYPE* tmp = this->new_array (len);
+ // Copy over the old sequence.
+ for (int i = 0; i < maximum_; ++i)
+ {
+ tmp[i] = buffer_[i];
+ }
+ if (release_)
+ {
+ this->delete_array (buffer_, maximum_);
+ }
+ buffer_ = tmp;
+ release_ = 1;
+ maximum_ = len;
+ // The destructor of -old- will release the old buffer_ if
+ // necessary.
+ }
+
+ length_ = len;
+}
+
+
+// g++ can't handle these operator [] functions if they're inline
+template <class TYPE> TYPE&
+ACE_CORBA_Sequence<TYPE>::operator [] (CORBA::ULong i)
+{
+ // @@ Should we do bounds checking?
+ if (i >= maximum_)
+ {
+ ACE_ERROR ((LM_ERROR, "Trying to write past maximum.\n"));
+ return buffer_[maximum_ - 1];
+ }
+ else
+ return buffer_[i];
+}
+
+template <class TYPE> const TYPE&
+ACE_CORBA_Sequence<TYPE>::operator [] (CORBA::ULong i) const
+{
+ if (i >= length_)
+ {
+ ACE_ERROR ((LM_ERROR, "Trying to read past length.\n"));
+ return buffer_[length_ - 1];
+ }
+
+ return buffer_[i];
+}
+
+// ********************
+
+/*
+template <class TYPE> void
+dump (const ACE_CORBA_Sequence<TYPE> &seq)
+{
+ for (CORBA::ULong index=0; index < seq.length (); index++)
+ dump (seq[index]);
+}
+*/
+
+/*
+template <class TYPE> ACE_INLINE void
+operator += (ACE_CORBA_Sequence<TYPE> &seq,
+ const TYPE &item)
+{
+ CORBA::ULong length = seq.length ();
+ seq.length (length + 1);
+ seq[length] = item;
+}
+*/
+
+template <class TYPE> ACE_INLINE void
+operator += (ACE_CORBA_Sequence<TYPE> &dest,
+ const ACE_CORBA_Sequence<TYPE> &source)
+{
+ int old_length = dest.length ();
+ int new_length = old_length + source.length ();
+ dest.length (new_length);
+
+ int difference = new_length - old_length;
+
+ for (int x=0; x < difference; x++)
+ dest[old_length + x] = source[x];
+}
+
+/*
+template <class TYPE> ACE_INLINE void
+remove_item (TYPE &seq, CORBA::ULong index)
+{
+ int new_length = seq.length () - 1;
+
+ // Shift the set back one, starting at <index>.
+ for (int x = index; x < new_length; x++)
+ seq[x] = seq[x+1];
+
+ // Set the new length.
+ seq.length (new_length);
+}
+*/
+
+// ************************************************************
+// ************************************************************
+// ************************************************************
+
+template<class TYPE>
+ACE_CORBA_var<TYPE>::ACE_CORBA_var (const ACE_CORBA_var<TYPE> &source)
+{
+ if (source.me_ != 0)
+ me_ = (TYPE *) source.me_->_duplicate ();
+ // CORBA::duplicate (source.me_);
+}
+
+template<class TYPE>
+ACE_CORBA_var<TYPE>::ACE_CORBA_var (void)
+ : me_ (0)
+{
+}
+
+template<class TYPE>
+ACE_CORBA_var<TYPE>::ACE_CORBA_var (TYPE *source)
+{
+ me_ = (TYPE *) source->_duplicate ();
+ // CORBA::duplicate (source);
+}
+
+template<class TYPE>
+ACE_CORBA_var<TYPE>::~ACE_CORBA_var (void)
+{
+ if (me_ != 0)
+ me_->_release ();
+ //CORBA::release (me_);
+}
+
+template<class TYPE> ACE_CORBA_var<TYPE> &
+ACE_CORBA_var<TYPE>::operator= (TYPE *source)
+{
+ if (me_ != source &&
+ me_ != 0)
+ me_->_release ();
+ //CORBA::release (me_);
+
+ me_ = (TYPE *) source->_duplicate ();
+ // CORBA::duplicate (source);
+ return *this;
+}
+
+template<class TYPE> ACE_CORBA_var<TYPE> &
+ACE_CORBA_var<TYPE>::operator= (const ACE_CORBA_var<TYPE> &source)
+{
+ if (me_ != source.me_ &&
+ me_ != 0)
+ me_->_release ();
+ // CORBA::release (me_);
+
+ me_ = (TYPE *) source.me_->_duplicate ();
+ // CORBA::duplicate (source.me_);
+ return *this;
+}
+
+template<class TYPE> TYPE *
+ACE_CORBA_var<TYPE>::operator->(void)
+{
+ return me_;
+}
+
+template<class TYPE>
+ACE_CORBA_var<TYPE>::operator TYPE *(void) const
+{
+ return me_;
+}
+
+/*
+template<class TYPE>
+ACE_CORBA_var<TYPE>::operator TYPE *&(void)
+{
+ return me_;
+}
+*/
+
+template<class TYPE>
+ACE_CORBA_var<TYPE>::operator TYPE &(void) const
+{
+ return *me_;
+}
+
+// ************************************************************
+// ************************************************************
+
+/*
+ACE_CORBA_Object_Ref<IMPL>::ACE_CORBA_Object_Ref (void)
+ : impl_ (0)
+{
+}
+
+ACE_CORBA_Object_Ref<IMPL>::ACE_CORBA_Object_Ref (IMPL *impl)
+ : impl_ (impl)
+{
+}
+
+ACE_CORBA_Object_Ref<IMPL>::~ACE_CORBA_Object_Ref (void)
+ : impl_ (0)
+{
+}
+
+ACE_CORBA_Object_Ref<IMPL> &
+ACE_CORBA_Object_Ref<IMPL>::operator= (const ACE_CORBA_Object_Ref<IMPL> &source)
+{
+ return *this;
+}
+
+IMPL *
+ACE_CORBA_Object_Ref<IMPL>::operator->(void)
+{
+ return impl_;
+}
+
+IMPL *
+ACE_CORBA_Object_Ref<IMPL>::operator IMPL *(void)
+{
+ return impl_;
+}
+
+ACE_CORBA_Object_Ref<IMPL> *
+ACE_CORBA_Object_Ref<IMPL>::_duplicate (ACE_CORBA_Object_Ref<IMPL> *source)
+{
+ source->ref_count_++;
+ return source;
+}
+
+*/
+#endif /* ACE_CORBA_UTILS_C */
diff --git a/TAO/local/bin/Event_Service/CORBA_Utils_T.h b/TAO/local/bin/Event_Service/CORBA_Utils_T.h
new file mode 100644
index 00000000000..8abf180d9e1
--- /dev/null
+++ b/TAO/local/bin/Event_Service/CORBA_Utils_T.h
@@ -0,0 +1,236 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ace_orb
+//
+// = FILENAME
+// CORBA_Utilities.h
+//
+// = AUTHORS
+// Tim Harrison.
+//
+// = NOTE
+// This class is a bit ackward when using a real ORB, but we cannot
+// easily remove it since some of the types are used in the
+// implementation of the EC. TODO
+//
+// ============================================================================
+
+#if !defined (ACE_CORBA_UTILS_H)
+#define ACE_CORBA_UTILS_H
+
+#include "ace/Time_Value.h"
+#include "tao/corba.h"
+
+template <class TYPE>
+class ACE_CORBA_Sequence// : public CORBA::Object
+// = TITLE
+//
+// = DESCRIPTION
+{
+public:
+
+ ACE_CORBA_Sequence (const ACE_CORBA_Sequence<TYPE> &source);
+ // Copy construction.
+
+ ACE_CORBA_Sequence (CORBA::ULong max);
+ ACE_CORBA_Sequence (CORBA::ULong max,
+ CORBA::ULong length,
+ TYPE* data,
+ CORBA::Boolean release = 0);
+ ACE_CORBA_Sequence (void);
+
+ virtual ~ACE_CORBA_Sequence (void);
+
+ ACE_CORBA_Sequence<TYPE> &operator= (const ACE_CORBA_Sequence<TYPE> &);
+
+ // static TYPE* allocbuf(CORBA::ULong nelems);
+ // static void freebuf(TYPE* data);
+
+ CORBA::ULong maximum (void) const;
+ CORBA::ULong length (void) const;
+ void length (CORBA::ULong len);
+
+ TYPE& operator [] (CORBA::ULong IT_i);
+
+ const TYPE& operator [] (CORBA::ULong IT_i) const;
+
+ virtual TYPE *new_array (size_t len);
+ // Allocates TYPE[len]. This facilitates template methods through
+ // template specialization to allow the use of different memory
+ // pools.
+
+ virtual void delete_array (TYPE *buf, size_t len);
+ // delete [] <buf>.
+
+protected:
+ CORBA::ULong maximum_;
+ CORBA::ULong length_;
+ TYPE* buffer_;
+ unsigned char release_;
+};
+
+// Utility for debugging sequences.
+//template <class TYPE>
+//void dump (const ACE_CORBA_Sequence<TYPE> &seq);
+
+// Utility for appending single items. Increases the length of <set>
+// and adds <event> to the end of <set>.
+template <class TYPE> void
+operator += (ACE_CORBA_Sequence<TYPE> &seq,
+ const TYPE &item)
+{
+ CORBA::ULong length = seq.length ();
+ seq.length (length + 1);
+ seq[length] = item;
+}
+
+// Utility for appending sequences.
+template <class TYPE> void
+operator += (ACE_CORBA_Sequence<TYPE> &dest,
+ const ACE_CORBA_Sequence<TYPE> &source);
+
+template <class TYPE> void
+remove_item (TYPE &seq, CORBA::ULong index)
+{
+ int new_length = seq.length () - 1;
+
+ // Shift the set back one, starting at <index>.
+ for (int x = index; x < new_length; x++)
+ seq[x] = seq[x+1];
+
+ // Set the new length.
+ seq.length (new_length);
+}
+// Removes seq[index] by moving everything after <index> back and
+// decrementing the length.
+
+// ************************************************************
+
+template <class TYPE>
+class ACE_CORBA_var
+// = TITLE
+//
+// = DESCRIPTION
+{
+public:
+ ACE_CORBA_var (const ACE_CORBA_var<TYPE> &source);
+ ACE_CORBA_var (void);
+ ACE_CORBA_var (TYPE *source);
+ ~ACE_CORBA_var (void);
+ ACE_CORBA_var<TYPE> &operator= (TYPE *source);
+ ACE_CORBA_var<TYPE> &operator= (const ACE_CORBA_var<TYPE> &source);
+ TYPE *operator->(void);
+ operator TYPE *(void) const;
+ // operator TYPE *&(void);
+ operator TYPE &(void) const;
+private:
+ TYPE *me_;
+};
+
+// ************************************************************
+
+/*
+template <class IMPL>
+class ACE_CORBA_Object_Ref : public CORBA::Object
+// = TITLE
+// ACE CORBA Object Reference
+//
+// = DESCRIPTION
+// A wrapper for making CORBA Object References. For a single
+// address space ORB, this points directly to the IMPL
+// class. This is supposed to look like a pointer to
+// IMPL with an additional static _duplicate method.
+{
+public:
+ // ACE_CORBA_Object_Ref (ACE_CORBA_Object_Ref<IMPL> &obj);
+ ACE_CORBA_Object_Ref (void);
+ ACE_CORBA_Object_Ref (IMPL *impl);
+ ~ACE_CORBA_Object_Ref (void);
+ // ACE_CORBA_Object_Ref<IMPL> &operator= (IMPL *source);
+ ACE_CORBA_Object_Ref<IMPL> &operator=
+ (const ACE_CORBA_Object_Ref<IMPL> &source);
+
+ IMPL *operator->(void);
+ // A distributed ORB would require that the CORBA Object Reference
+ // implement all IMPL interfaces, marshall the parameters,
+ // and transmit over IIOP. For this single address space ORB, we'll
+ // just delegate method calls to the IMPL directly.
+
+ operator IMPL *(void) const;
+ // operator IMPL *&(void);
+ // operator IMPL &(void) const;
+
+ static ACE_CORBA_Object_Ref<IMPL> *_duplicate
+ (ACE_CORBA_Object_Ref<IMPL> *source);
+
+private:
+ IMPL *impl_;
+};
+*/
+
+// ************************************************************
+
+template <class ITEM, size_t SIZE>
+class ACE_ES_Simple_Array
+// = TITLE
+// Simple Array
+//
+// = DESCRIPTION
+// Wraps ITEM[SIZE] with insert and an iterator. There is no
+// remove. It allows duplicates. It is truly very simple.
+{
+ public:
+ ACE_ES_Simple_Array (void);
+ int insert (const ITEM &copy_me);
+ size_t size (void);
+ ITEM *data (void);
+ protected:
+ ITEM data_[SIZE];
+ size_t size_;
+};
+
+template <class ITEM>
+class ACE_ES_Array_Iterator
+// = TITLE
+// Simple Iterator
+//
+// = DESCRIPTION
+// Iterates through an array of ITEMs.
+{
+public:
+ ACE_ES_Array_Iterator (ITEM *data, size_t size);
+
+ int next (ITEM *&next_item);
+ // Returns 0 when all items have been seen, else 1. Sets
+ // <next_item> to point at the next ITEM.
+
+ int advance (void);
+ // Move forward by one element in the Stack. Returns 0 when all the
+ // items in the Stack have been seen, else 1.
+
+ int done (void) const;
+ // Returns 1 when all items have been seen, else 0.
+
+private:
+ ITEM *data_;
+ size_t size_;
+ size_t index_;
+};
+
+#if defined (__ACE_INLINE__)
+#include "CORBA_Utils_T.i"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "CORBA_Utils_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("CORBA_Utils_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#endif /* ACE_CORBA_UTILS_H */
diff --git a/TAO/local/bin/Event_Service/CORBA_Utils_T.i b/TAO/local/bin/Event_Service/CORBA_Utils_T.i
new file mode 100644
index 00000000000..b31b093baf2
--- /dev/null
+++ b/TAO/local/bin/Event_Service/CORBA_Utils_T.i
@@ -0,0 +1,70 @@
+/* -*- C++ -*- */
+// $Id$
+
+template <class TYPE> ACE_INLINE CORBA::ULong
+ACE_CORBA_Sequence<TYPE>::maximum (void) const
+{
+ return maximum_;
+}
+
+template <class TYPE> ACE_INLINE CORBA::ULong
+ACE_CORBA_Sequence<TYPE>::length() const
+{
+ return length_;
+}
+
+
+// ************************************************************
+
+template <class ITEM, size_t SIZE> ACE_INLINE
+ACE_ES_Simple_Array<ITEM, SIZE>::ACE_ES_Simple_Array (void) :
+ size_ (0)
+{
+}
+
+template <class ITEM, size_t SIZE> ACE_INLINE int
+ACE_ES_Simple_Array<ITEM, SIZE>::insert (const ITEM &copy_me)
+{
+ if (size_ >= SIZE)
+ return -1;
+
+ data_[size_++] = copy_me;
+ return 0;
+}
+
+template <class ITEM, size_t SIZE> ACE_INLINE size_t
+ACE_ES_Simple_Array<ITEM, SIZE>::size (void)
+{
+ return size_;
+}
+
+template <class ITEM, size_t SIZE> ACE_INLINE ITEM *
+ACE_ES_Simple_Array<ITEM, SIZE>::data (void)
+{
+ return data_;
+}
+
+// ************************************************************
+
+template <class ITEM> ACE_INLINE
+ACE_ES_Array_Iterator<ITEM>::ACE_ES_Array_Iterator (ITEM *data, size_t size) :
+ data_ (data),
+ size_ (size),
+ index_ (0)
+{
+}
+
+template <class ITEM> ACE_INLINE int
+ACE_ES_Array_Iterator<ITEM>::next (ITEM *&next_item)
+{
+ next_item = &data_[index_];
+ return index_ < (size_ - 1);
+}
+
+template <class ITEM> ACE_INLINE int
+ACE_ES_Array_Iterator<ITEM>::advance (void)
+{
+ index_++;
+ return index_ < size_;
+}
+
diff --git a/TAO/local/bin/Event_Service/Channel_Clients.i b/TAO/local/bin/Event_Service/Channel_Clients.i
new file mode 100644
index 00000000000..6318deb79a0
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Channel_Clients.i
@@ -0,0 +1,2 @@
+/* -*- C++ -*- */
+// $Id$
diff --git a/TAO/local/bin/Event_Service/Channel_Clients_T.i b/TAO/local/bin/Event_Service/Channel_Clients_T.i
new file mode 100644
index 00000000000..f7c0760fd86
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Channel_Clients_T.i
@@ -0,0 +1,35 @@
+/* -*- C++ -*- */
+// $Id$
+
+template <class TARGET> ACE_INLINE
+ACE_PushConsumer_Adapter<TARGET>::ACE_PushConsumer_Adapter (TARGET *target)
+ : target_ (target)
+{
+}
+
+template <class TARGET> ACE_INLINE void
+ACE_PushConsumer_Adapter<TARGET>::push (const RtecEventComm::EventSet& events,
+ CORBA::Environment &_env)
+{
+ target_->_push (events, _env);
+}
+
+template <class TARGET> ACE_INLINE void
+ACE_PushConsumer_Adapter<TARGET>::disconnect_push_consumer (CORBA::Environment &_env)
+{
+ target_->_disconnect_push_consumer (_env);
+}
+
+// ************************************************************
+
+template <class TARGET> ACE_INLINE
+ACE_PushSupplier_Adapter<TARGET>::ACE_PushSupplier_Adapter (TARGET *target)
+ : target_ (target)
+{
+}
+
+template <class TARGET> ACE_INLINE void
+ACE_PushSupplier_Adapter<TARGET>::disconnect_push_supplier (CORBA::Environment &_env)
+{
+ target_->_disconnect_push_supplier (_env);
+}
diff --git a/TAO/local/bin/Event_Service/Debug_Macros.h b/TAO/local/bin/Event_Service/Debug_Macros.h
new file mode 100644
index 00000000000..8db3d169082
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Debug_Macros.h
@@ -0,0 +1,11 @@
+
+#if defined (ACE_ES_NOLOGGING)
+#define ACE_ES_DEBUG(X)
+#define ACE_ES_DEBUG_ST(X)
+#else
+#define ACE_ES_DEBUG(X) \
+ do { \
+ ACE_Log_Msg::instance ()->log X; \
+ } while (0)
+#define ACE_ES_DEBUG_ST(X) X
+#endif /* ACE_ES_NOLOGGING */
diff --git a/TAO/local/bin/Event_Service/Dispatching_Modules.cpp b/TAO/local/bin/Event_Service/Dispatching_Modules.cpp
new file mode 100644
index 00000000000..13d8cbe0d46
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Dispatching_Modules.cpp
@@ -0,0 +1,603 @@
+// $Id$
+
+#include "ace/Sched_Params.h"
+#include "Memory_Pools.h"
+#include "Scheduler_Factory.h"
+
+#include "Dispatching_Modules.h"
+
+#if !defined (__ACE_INLINE__)
+#include "Dispatching_Modules.i"
+#endif /* __ACE_INLINE__ */
+
+typedef ACE_EventChannel::DISPATCH_ERROR DISPATCH_ERROR;
+typedef ACE_EventChannel::SYNCHRONIZATION_ERROR SYNC_ERROR;
+typedef ACE_EventChannel::QOS_ERROR QOS_ERROR;
+
+// ************************************************************
+
+void
+ACE_ES_Dispatch_Request::make_copy (RtecEventComm::EventSet &dest) const
+{
+ if (use_single_event_)
+ {
+ dest.length (1);
+ dest[0] = single_event_;
+ }
+ else
+ {
+ dest.length (event_set_.length ());
+
+ for (CORBA::ULong index=0; index < event_set_.length (); index++)
+ {
+ RtecEventComm::Event &dest_event = dest[index];
+ ACE_ES_Event_Container_var &source_event_var = ((ACE_ES_Event_Container_var &) event_set_[index]);
+ dest_event = *(source_event_var.operator->());
+ }
+ }
+}
+
+int
+ACE_ES_Dispatch_Request::execute (u_long &command_action)
+{
+ ACE_TIMEPROBE ("dispatch (dequeue) the event");
+
+ return dispatching_module_->dispatch_event (this, command_action);
+}
+
+#if 0
+void *
+ACE_ES_Dispatch_Request::operator new (size_t nbytes)
+{
+ if (nbytes > sizeof (ACE_ES_Dispatch_Request))
+ {
+ ACE_ERROR ((LM_ERROR, "nbytes = %d, sizeof (ACE_ES_Dispatch_Request_Chunk) = %d.\n",
+ sizeof (ACE_ES_Dispatch_Request)));
+ ACE_ASSERT (nbytes <= sizeof (ACE_ES_Dispatch_Request));
+ }
+
+ return ACE_ES_Memory_Pools::new_Dispatch_Request ();
+}
+
+void
+ACE_ES_Dispatch_Request::operator delete (void *mem)
+{
+ ACE_ES_Memory_Pools::delete_Dispatch_Request (mem);
+}
+#endif /* 0 */
+
+// ************************************************************
+
+ACE_ES_Priority_Dispatching::ACE_ES_Priority_Dispatching (ACE_EventChannel *channel,
+ int threads_per_queue)
+ : ACE_ES_Dispatching_Base (channel),
+ notification_strategy_ (this),
+ highest_priority_ (0),
+ shutdown_ (0),
+ threads_per_queue_ (threads_per_queue)
+{
+ // If we're single threaded, then we need to use the notification strategy.
+ if ((threads_per_queue_ == 0) &&
+ (notification_strategy_.open () == -1))
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_ES_Priority_Dispatching"));
+
+ // Initialize the queues.
+ for (int x=0; x < ACE_Scheduler_MAX_PRIORITIES; x++)
+ {
+ queues_[x] = 0;
+ delete_me_queues_[x] = 0;
+ }
+
+ this->initialize_queues ();
+}
+
+ACE_ES_Priority_Dispatching::~ACE_ES_Priority_Dispatching (void)
+{
+ // Delete the queues.
+ for (int x=0; x < ACE_Scheduler_MAX_PRIORITIES; x++)
+ delete delete_me_queues_[x];
+}
+
+
+void
+ACE_ES_Priority_Dispatching::initialize_queues (void)
+{
+ for (int x=0; x < ACE_Scheduler_MAX_PRIORITIES; x++)
+ {
+ RtecScheduler::Period tv = ACE_Scheduler_Rates[x];
+ queues_[x] = new ACE_ES_Dispatch_Queue (this, &notification_strategy_);
+ if (queues_[x] == 0 ||
+ queues_[x]->open_queue (tv, threads_per_queue_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_ES_Priority_Dispatching::initialize_queues"));
+ return;
+ }
+
+ queue_count_[x] = 1;
+ }
+
+ highest_priority_ = ACE_Scheduler_MAX_PRIORITIES - 1;
+}
+
+void
+ACE_ES_Priority_Dispatching::connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &_env)
+{
+ down_->connected (consumer, _env);
+
+ // This code does dynamic allocation of channel dispatch threads.
+ // It requires that consumer's priorities are known at connection
+ // time and that threads can request priorities from the scheduler
+ // at run-time. These are both antithetical to static scheduling.
+ // The constructor now allocates a thread per rate group.
+#if 0
+ // We have to tell the lower portions of the channel about the
+ // consumer first. This is so that any changes to the consumer's
+ // qos will take effect when we get the dispatch priority.
+ down_->connected (consumer, _env);
+
+ RtecScheduler::OS_Priority priority =
+ ACE_Scheduler::instance ().preemption_priority (consumer->qos ().rt_info_);
+
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+
+ // If a queue has not been created for the consumer's priority,
+ // create one.
+ if (queues_[priority] == 0)
+ {
+ // Allocate a new dispatch queue.
+ queues_[priority] = new ACE_ES_Dispatch_Queue (this, &notification_strategy_);
+ if (queues_[priority] == 0)
+ ACE_THROW (CORBA::NO_MEMORY (0, CORBA::COMPLETED_NO,
+ "ACE_ES_Priority_Dispatching::connected"));
+
+ // Initialize the dispatch queue corresponding to the
+ // consumer's priority. With a full implementation of the
+ // run-time scheduler, the dispatch queue can find it's
+ // scheduling qos online. However, we pass the rate in case
+ // one is not found. The rate can be used to obtain the
+ // proper priority. If threads_per_queue_ == 0, then these
+ // queues will be passive. Otherwise, they will be active.
+ // This switches us between MT_ORB and ST_ORB. If we're
+ // single-threaded, this registers us with the ReactorEx using
+ // our notification_strategy_. If we're multi-threaded, this
+ // spawns the threads.
+ if (queues_[priority]->open_queue (priority,
+ threads_per_queue_) == -1)
+ ACE_THROW (DISPATCH_ERROR (0, CORBA::COMPLETED_NO,
+ "ACE_ES_Priority_Dispatching::connected:"
+ "queue open failed.\n"));
+
+ // When this goes down to 0, we will shutdown the queue.
+ queue_count_[priority] = 1;
+
+ // Keep track of this to optimize handle_signal.
+ if (priority > highest_priority_)
+ highest_priority_ = priority;
+
+ ACE_DEBUG ((LM_DEBUG, "Created queue priority = %d.\n", priority));
+ }
+ else
+ queue_count_[priority]++;
+ }
+#endif
+}
+
+void
+ACE_ES_Priority_Dispatching::disconnected (ACE_Push_Consumer_Proxy *consumer)
+{
+ // We'll not dynamically close down queues.
+ ACE_UNUSED_ARG (consumer);
+
+#if 0
+ RtecScheduler::OS_Priority priority =
+ ACE_Scheduler::instance ().preemption_priority (consumer->qos ().rt_info_);
+
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+
+ // If there are no more users of this queue, then we *could* shut
+ // it down. However, we will not.
+ if (--queue_count_[priority] <= 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) unused dispatch queue priority = %d, "
+ "is_empty = %d.\n",
+ priority, queues_[priority]->msg_queue ()->is_empty ()));
+
+ queues_[priority]->shutdown_task ();
+ }
+ }
+#endif
+}
+
+// @@ This method could have a bypass optimization.
+// <request> has been dynamically allocated by the filtering module.
+void
+ACE_ES_Priority_Dispatching::push (ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &_env)
+{
+ ACE_TIMEPROBE (" push_source_type: Correlation Module");
+
+ RtecScheduler::OS_Priority thread_priority;
+ RtecScheduler::Sub_Priority subpriority;
+ RtecScheduler::Preemption_Priority preemption_priority;
+
+ if (request->rt_info () != 0)
+ {
+ ACE_Scheduler_Factory::server ()->priority
+ (request->rt_info (),
+ thread_priority,
+ subpriority,
+ preemption_priority,
+ _env);
+ if (_env.exception ())
+ {
+ return;
+ }
+ }
+ else
+ {
+ thread_priority =
+ ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
+ ACE_SCOPE_PROCESS);
+ subpriority = ACE_Scheduler_MIN_SUB_PRIORITY;
+ preemption_priority = ACE_Scheduler_MIN_PREEMPTION_PRIORITY;
+ }
+
+ // If it's a request to forward an event, it needs a reference to us
+ // to call dispatch_event.
+ request->set (this, preemption_priority, subpriority);
+
+ // Make sure that a queue exists for this priority.
+ if (queues_[preemption_priority] == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "Push to closed queue %d, dropping event.\n", preemption_priority));
+ return;
+#if 0
+ ACE_THROW (SYNC_ERROR (0, CORBA::COMPLETED_NO, "ACE_ES_Priority_Dispatching::push"));
+#endif /* 0 */
+ }
+
+ // Enqueue the request. If we're multi-threaded, this request is a
+ // command object that will be called by the threads in the queue,
+ // or will be dequeued by this->handle_signal if we're
+ // single-threaded.
+ if (queues_[preemption_priority]->try_put (request) == -1)
+ {
+ if (ACE_ES_Dispatch_Request::release (request) != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Priority_Dispatching::push"
+ " release failed.\n"));
+ if (errno != EPIPE)
+ {
+ ACE_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ // @@ Orbix parameters
+ // 0, CORBA::COMPLETED_NO,
+ // "ACE_ES_Priority_Dispatching::push enqueue failed"));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Request rejected from closed queue %d.\n",
+ preemption_priority));
+ }
+ }
+}
+
+// Start at highest priority queue checking for queued events
+// continuing to lowest priority queue. If an event is ever found,
+// dispatch it and then start back at the highest priority queue
+// again.
+int
+ACE_ES_Priority_Dispatching::handle_signal (int, siginfo_t *, ucontext_t *)
+{
+ int done;
+
+ do
+ {
+ done = 1;
+ for (int x = 0; x <= highest_priority_; x++)
+ {
+ // If the queue is not empty, dispatch the request and then
+ // start the for loop from the beginning.
+ if ((queues_[x] != 0) && (!queues_[x]->msg_queue ()->is_empty ()))
+ {
+ // Dequeue and service the request.
+ queues_[x]->svc_one ();
+
+ // Exit the for loop and start over.
+ done = 0;
+ break;
+ }
+
+ // If we get through the whole for loop without dispatching
+ // anything, then we're done.
+ }
+ }
+ while (!done);
+
+
+ return 0;
+}
+
+// This is only for the non-win32 single-threaded implementation.
+int
+ACE_ES_Priority_Dispatching::handle_input (ACE_HANDLE)
+{
+ return this->handle_signal (0, 0, 0);
+}
+
+// Shutdown each queue. When each queue exits, they will call back
+// this->dispatch_queue_closed which allows us to free up resources.
+// When the last queue has closed, we'll delete ourselves.
+void
+ACE_ES_Priority_Dispatching::shutdown (void)
+{
+ if (shutdown_)
+ return;
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) ACE_ES_Priority_Dispatching "
+ "module shutting down.\n"));
+
+ shutdown_ = 1;
+
+ // If we're single threaded, then we need to shut down the
+ // notification strategy so it can remove itself from the reactor.
+ if (threads_per_queue_ == 0)
+ notification_strategy_.shutdown ();
+
+ // Whether these are active or not, they must be shut down.
+ for (int x = 0; x <= highest_priority_; x++)
+ if (queues_[x] != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "shutting down dispatch queue %d.\n", x));
+ queues_[x]->shutdown_task ();
+ }
+}
+
+// This gets called every time a Dispatch Queue closes down. We
+// search for <queue> and delete it. If we have been told to delete
+// ourself, after the last queue has been deleted, we delete
+// ourselves.
+void
+ACE_ES_Priority_Dispatching::dispatch_queue_closed (ACE_ES_Dispatch_Queue *queue)
+{
+ ACE_ES_GUARD ace_mon (lock_);
+
+ // Find the queue.
+ for (int x = 0; x <= highest_priority_; x++)
+ {
+ if (queues_[x] == queue)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) Dispatch queue %d is closed.\n", x));
+
+ // Store the queue for deleting in this object's destructor.
+ delete_me_queues_[x] = queues_[x];
+ queues_[x] = 0;
+
+ // Reset highest_priority_.
+ if (x == highest_priority_)
+ {
+ while ((--highest_priority_ >= 0) &&
+ (queues_[highest_priority_] == 0));
+
+ if (highest_priority_ < 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Dispatching module shut down.\n"));
+ up_->shutdown ();
+ return;
+ }
+ }
+
+ // If we found the queue, we can exit the for loop.
+ break;
+ }
+ }
+}
+
+/*
+ACE_HANDLE
+ACE_ES_Priority_Dispatching::get_handle (void) const
+{
+ ACE_ES_Priority_Dispatching *fake_this = (ACE_ES_Priority_Dispatching *) this;
+ return fake_this->notification_strategy_.get_handle ();
+}
+*/
+
+// ************************************************************
+
+ACE_ES_Dispatch_Queue::ACE_ES_Dispatch_Queue (ACE_ES_Dispatching_Base *dispatching_module,
+ ACE_ES_Notification_Strategy *notification_strategy)
+ : dispatching_module_ (dispatching_module),
+ notification_strategy_ (notification_strategy)
+{
+}
+
+int
+ACE_ES_Dispatch_Queue::open_queue (RtecScheduler::Period &period,
+ int threads)
+{
+ // First set up the correct message queue according to whether the
+ // dispatch queue will be active or not.
+
+ // If there are no threads specified, we'll register with the
+ // reactor to be called back when someone queues a message.
+ if (threads == 0)
+ {
+ // Allocate a message queue that notifies a reactor when events
+ // arrive via the msg_queue call. If that succeeds, set the
+ // notification strategy in our message queue via the open call.
+ if (this->msg_queue () == 0 ||
+ this->msg_queue ()->open (ACE_ES_QUEUE::DEFAULT_HWM,
+ ACE_ES_QUEUE::DEFAULT_LWM,
+ notification_strategy_) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p msg_queue.open failed.\n",
+ "ACE_ES_Dispatch_Queue::open_queue"), -1);
+ }
+ else
+ {
+ // Allocate a message queue that does not notify.
+ ACE_ES_MQ *mq = new ACE_ES_MQ;
+ if (mq == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Dispatch_Queue::open_queue"), -1);
+ else
+ {
+ // This deletes previous message queue.
+ this->msg_queue (mq);
+ // Set this so that the destructor of ACE_Task deletes our
+ // message queue. Note, this must be after the call to
+ // msg_queue.
+ delete_msg_queue_ = 1;
+ }
+ }
+
+ // Create a name for ourselves using the priority.
+ char temp[64];
+ ACE_OS::sprintf (temp, "ACE_ES_Dispatch_Queue-%u", period);
+
+ // Open the task. This will query the scheduler for our qos
+ // structure. It will also synch_threads if it succeeds.
+ int result = this->open_task (temp);
+
+ switch (result)
+ {
+ case -1:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Dispatch_Queue::open_queue"), -1);
+ case 0:
+ ACE_TRY
+ {// @@ TODO: Handle exceptions...
+ ACE_Scheduler_Factory::server()->set(rt_info_,
+ 0, 0, 0, 0,
+ RtecScheduler::VERY_LOW,
+ RtecScheduler::NO_QUANTUM,
+ 1, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "ACE_ES_Display_Queue::exception"), -1);
+ }
+ ACE_ENDTRY;
+ case 1:
+ // Found.
+ break;
+ }
+
+ // Spawn threads.
+ return this->synch_threads (threads);
+}
+
+// This is called back by ACE_RT_Task when all the threads have
+// exited. We're going to forward this event to the dispatching
+// module so it can clean up any resources.
+void
+ACE_ES_Dispatch_Queue::threads_closed (void)
+{
+ dispatching_module_->dispatch_queue_closed (this);
+}
+
+// ************************************************************
+
+ACE_ES_EFD_Dispatching::ACE_ES_EFD_Dispatching (ACE_EventChannel *channel)
+ : ACE_ES_Dispatching_Base (channel)
+{
+}
+
+void
+ACE_ES_EFD_Dispatching::push (ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &)
+{
+ // If it's a request to forward an event, it needs a reference to us
+ // to call dispatch_event.
+ request->set (this, 0, ACE_Scheduler_MIN_SUB_PRIORITY);
+
+ u_long command_action = ACE_RT_Task_Command::RELEASE;
+
+ // This may be a request to delete a push consumer proxy, so we
+ // should execute it instead of just forwarding it.
+ request->execute (command_action);
+
+ switch (command_action)
+ {
+ case ACE_RT_Task_Command::RELEASE:
+ // Free the request.
+ if (ACE_ES_Dispatch_Request::release (request) != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_EFD_Dispatching::push"
+ " release failed.\n"));
+ break;
+
+ default:
+ ACE_ERROR ((LM_ERROR, "ACE_ES_EFD_Dispatching::push: unknown command action.\n"));
+ }
+}
+
+// ************************************************************
+
+ACE_ES_RTU_Dispatching::ACE_ES_RTU_Dispatching (ACE_EventChannel *channel)
+ : ACE_ES_Priority_Dispatching (channel, 0)
+{
+}
+
+// We're called from a dispatch queue, so we can not release the request.
+int
+ACE_ES_RTU_Dispatching::dispatch_event (ACE_ES_Dispatch_Request *request,
+ u_long &command_action)
+{
+ // Store the priority of the task currently running.
+ channel_->rtu_manager ()->priority (request->priority ());
+
+ ACE_TRY
+ {
+ // Forward the request.
+ up_->push (request, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_ES_RTU_Dispatching::dispatch_event unknown exception.\n"));
+ }
+ ACE_ENDTRY;
+
+ // Reset the priority.
+ channel_->rtu_manager ()->priority (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO, ACE_SCOPE_PROCESS));
+
+ // If the task was preempted, enqueue the request on the head of the
+ // dispatch queue.
+ if (channel_->rtu_manager ()->not_done ())
+ command_action = ACE_RT_Task_Command::UNGETQ;
+ else
+ // We're done with it.
+ command_action = ACE_RT_Task_Command::RELEASE;
+
+ return 0;
+}
+
+void
+ACE_ES_RTU_Dispatching::push (ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &_env)
+{
+ // First enqueue the message in the proper queue.
+ ACE_ES_Priority_Dispatching::push (request, _env);
+
+ // If the current event is higher priority (lower value) than the
+ // current running task, then tell the task to preempt itself.
+ int request_priority = request->priority ();
+ int running_priority = channel_->rtu_manager ()->priority ();
+ if (request_priority < running_priority)
+ channel_->rtu_manager ()->should_preempt (1);
+ return;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_CORBA_Sequence<ACE_CORBA_var<ACE_ES_Event_Container> >;
+template void operator+=(ACE_CORBA_Sequence<ACE_CORBA_var<ACE_ES_Event_Container> > &, ACE_CORBA_var<ACE_ES_Event_Container> const &);
+
+#if defined(ACE_ES_LACKS_ORB)
+template class ACE_CORBA_Sequence<ACE_ES_Event>;
+#endif /* ACE_ES_LACKS_ORB */
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/local/bin/Event_Service/Dispatching_Modules.h b/TAO/local/bin/Event_Service/Dispatching_Modules.h
new file mode 100644
index 00000000000..31ce297788b
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Dispatching_Modules.h
@@ -0,0 +1,484 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// Dispatching_Module
+//
+// = AUTHOR
+// Tim Harrison (harrison@cs.wustl.edu)
+//
+// = DESCRIPTION
+// This file holds the different Event Service dispatching
+// mechanisms. These include null-dispatching (EFD),
+// single-threaded with (RTU) and without preemption (LAME), and a
+// multithreaded implementation.
+//
+// ============================================================================
+
+#ifndef ACE_DISPATCHING_MODULES_H
+#define ACE_DISPATCHING_MODULES_H
+
+#include "ReactorTask.h"
+#include "Event_Channel.h"
+
+// ************************************************************
+
+// Forward declarations.
+class ACE_ES_Dispatch_Queue;
+class ACE_ES_Dispatch_Request;
+
+// ************************************************************
+
+// Forward declarations.
+class ACE_ES_Consumer_Module;
+
+class ACE_ES_Dispatching_Base : public ACE_Event_Handler
+// = TITLE
+// Event Service Dispatch Module base class
+//
+// = DESCRIPTION
+// We inherit from ACE_Event_Handler so that we can be called back
+// by the ReactorEx when requests are queued. The virtual
+// dispatch_event method allows ACE_ES_Dispatch_Requests to call
+// back the dispatching module when acting as command objects. When
+// this implementation is used by the Event Channel it forwards all
+// dispatch calls without any queuing. Therefore, it can be
+// used to build an EFD. It is also inherited by the Priority
+// Dispatching module.
+{
+public:
+ ACE_ES_Dispatching_Base (ACE_EventChannel *channel);
+ // Default construction.
+
+ virtual void open (ACE_ES_Consumer_Module *up,
+ ACE_ES_Correlation_Module *down);
+ // Link to adjacent modules.
+
+ virtual void connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &);
+ // Forward down_.
+
+ virtual void disconnecting (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &);
+ // Forward down_.
+
+ virtual void disconnected (ACE_Push_Consumer_Proxy *consumer);
+ // Release any unneeded dispatching resources.
+
+ // = Not needed.
+ // void connected (ACE_Push_Supplier_Proxy *supplier);
+ // void disconnecting (ACE_Push_Supplier_Proxy *supplier);
+
+ virtual void push (ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &) = 0;
+ // Forward up_.
+
+ virtual int dispatch_event (ACE_ES_Dispatch_Request *request,
+ u_long &command_action);
+ // Called by ACE_ES_Dispatch_Requests when dequeued by RT_Tasks.
+
+ virtual void dispatch_queue_closed (ACE_ES_Dispatch_Queue *q);
+ // Called when all the threads of a <q> have exited.
+
+ virtual void shutdown (void);
+ // This is called by the Event Channel. This will attempt to shut
+ // down all of its threads gracefully. Wish it luck.
+
+protected:
+ ACE_EventChannel *channel_;
+ // Dat der channel.
+
+ ACE_ES_MUTEX lock_;
+ // To synchronize thr_count_.
+
+ int thr_count_;
+ // The total number of threads in the Dispatching Module. This will
+ // be the sum of all the Dispatch Queue threads.
+
+ ACE_ES_Consumer_Module *up_;
+ // Next module up.
+
+ ACE_ES_Correlation_Module *down_;
+ // Next module down.
+};
+
+// ************************************************************
+
+class ACE_ES_Dispatch_Request : public ACE_RT_Task_Command
+// = TITLE
+// ACE Event Service Dispatch Request
+//
+// = DESCRIPTION
+// Encapsulates a consumer and the events that will be sent to the
+// consumer. Right now, this class keeps a single_event_ that can
+// be used when only one event is sent to the consumer. Since this
+// is frequently the case (except for correlations), this
+// optimization reduces the amount of dynamic memory allocation is
+// necessary. This class is also a GOF Command object since it can
+// be dequeued by an RT_Task to call back the dispatching module
+// for request dispatching.
+{
+public:
+ typedef ACE_CORBA_Sequence<ACE_ES_Event_Container_var> Event_Set;
+
+ ACE_ES_Dispatch_Request (void);
+ // Default construction.
+
+ virtual ~ACE_ES_Dispatch_Request (void);
+ // Default destruction.
+
+ ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ RtecScheduler::handle_t rt_info);
+ // All the events must be added after construction to the
+ // event_set.
+
+ ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ const Event_Set &event_set,
+ RtecScheduler::handle_t rt_info);
+ // Set consumer_ to <consumer> and copy <event_set> to event_set_.
+ // <rt_info> describes the method receiving this dispatch.
+
+ ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ const RtecEventComm::Time &time,
+ RtecScheduler::handle_t rt_info);
+ // Set consumer_ to <consumer> and sets single_event_.time_ to
+ // <time>. Sets use_single_event_ to 1. <rt_info> describes the
+ // method receiving this dispatch.
+
+ ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ ACE_ES_Event_Container *event,
+ RtecScheduler::handle_t rt_info);
+ // Sets consumer_ and the first slot of event_set_. We use the
+ // event_set_ instead of the single_event_ so that we can just carry
+ // around the pointer to <event>. <rt_info> describes the method
+ // receiving this dispatch.
+
+ RtecScheduler::handle_t rt_info (void);
+ // Description of the method receiving this request.
+
+ void set (ACE_ES_Dispatching_Base *dispatching_module,
+ RtecScheduler::OS_Priority priority,
+ RtecScheduler::Sub_Priority sub_priority);
+ // For multi-threaded implementations, <dispatching_module> is
+ // called back when a request is dequeued. <priority> is the
+ // dispatch priority of the event. <sub_priority> is the enqueue
+ // priority of the event and will be forwarded to
+ // ACE_Message_Block.
+
+ ACE_Push_Consumer_Proxy *consumer (void) const;
+ // Consumer accessor.
+
+ const Event_Set &event_set (void) const;
+ // If accessed, make_copy will use event_set_.
+
+ Event_Set &event_set (void);
+ // If accessed, make_copy will use event_set_.
+
+ CORBA::ULong number_of_events (void) const;
+ // Returns 1 if we're using single_event, or event_set_.size ().
+
+ void make_copy (RtecEventComm::EventSet &dest) const;
+ // Copy single_event or event_set into <dest>.
+
+ virtual int execute (u_long &command_action);
+ // Calls dispatching_module_->dispatch_event.
+
+ RtecScheduler::OS_Priority priority (void);
+ // Priority accessor.
+
+#if 0
+ // @@ This cannot be done: the object would be allocated using this
+ // class operator new, but it will be removed using the
+ // ACE_Message_Block operator delete!
+ void *operator new (size_t nbytes);
+ // Allocates memory from a thread-specific memory pool.
+
+ void operator delete (void *);
+ // Returns memory to a thread-specific memory pool.
+#endif
+
+protected:
+ RtecScheduler::OS_Priority priority_;
+
+ RtecScheduler::handle_t rt_info_;
+ // Describes the method receiving this dispatch.
+
+ ACE_ES_Dispatching_Base *dispatching_module_;
+ // The dispatching module called back when we're dequeued by a
+ // thread.
+
+ int use_single_event_;
+ // Is true if we're using a single event. Is 0 is we're using
+ // event_set_.
+
+ ACE_Push_Consumer_Proxy *consumer_;
+ // The final destination for single_event_ or event_set_.
+
+ ACE_ES_Event_Container single_event_;
+ // This is used for single event dispatches.
+
+ Event_Set event_set_;
+ // This is used for event sets that need to be dispatched.
+};
+
+// ************************************************************
+
+#if defined (ACE_WIN32)
+class ACE_ES_ReactorEx_NS : public ACE_Notification_Strategy
+// = TITLE
+// Event Service ReactorEx Notification Strategy
+//
+// = DESCRIPTION
+// Integrates the ACE_Message_Queue notification to signal a
+// handle that will wake up the ACE_ES_Priority_Dispatching
+// module. This is used in place of the
+// ACE_ReactorEx_Notification_Strategy to avoid any queueing by
+// the ReactorEx::notify mechanism.
+{
+public:
+ ACE_ES_ReactorEx_NS (ACE_Event_Handler *eh);
+ // Stores away <eh> for when this->open is called.
+
+ int open (void);
+ // Registers eh_ with the ReactorEx to be notified when this->notify
+ // is called.
+
+ void shutdown (void);
+ // Removes self from the reactor.
+
+ // = These result in eh_->handle_signal getting called. eh_ should
+ // point to a dispatching module.
+ virtual int notify (void);
+ virtual int notify (ACE_Event_Handler *,
+ ACE_Reactor_Mask mask);
+
+ // ACE_HANDLE get_handle (void);
+ // Returns event_.handle ().
+
+private:
+ ACE_Auto_Event event_;
+ // Registered with the ReactorEx.
+};
+
+typedef ACE_ES_ReactorEx_NS ACE_ES_Notification_Strategy;
+
+#else // *******************************************************
+
+class ACE_ES_Reactor_NS : public ACE_Reactor_Notification_Strategy
+// = TITLE
+// Event Service Reactor Notification Strategy
+//
+// = DESCRIPTION
+// Maps to the ACE_Reactor_Notification_Strategy interface. This
+// version is for non WIN32 platforms.
+{
+public:
+ ACE_ES_Reactor_NS (ACE_Event_Handler *eh);
+ // Calls ACE_Reactor_Notification_Strategy with the ORB's reactor
+ // and signal mask.
+
+ int open (void);
+ // Does nothing.
+
+ void shutdown (void);
+ // Does nothing.
+};
+
+typedef ACE_ES_Reactor_NS ACE_ES_Notification_Strategy;
+
+#endif /* ACE_WIN32 */
+
+// ************************************************************
+
+class ACE_ES_MQ : public ACE_ES_QUEUE
+// = TITLE
+// Event Service Message Queue
+{
+ virtual int notify (void) { return 0;}
+ // Does nothing.
+};
+
+// ************************************************************
+
+class ACE_ES_Dispatch_Queue : public ACE_RT_Task
+// = TITLE
+// Event Service Dispatch Queue
+//
+// = DESCRIPTION
+// An encapsulation of a dispatch queue. By inheriting from
+// ACE_RT_Task, we can make this zero-threaded or multi-threaded.
+{
+public:
+ ACE_ES_Dispatch_Queue (ACE_ES_Dispatching_Base *dispatching_module,
+ ACE_ES_Notification_Strategy *notification_strategy);
+ // Stores <dispatching_module> for this->threads_closed. Stores
+ // away <notification_strategy> for this->synch_threads.
+
+ int open_queue (RtecScheduler::Period &period,
+ int threads);
+ // This is a hack to get the channel to work with the new
+ // scheduler.
+
+#if 0
+ int open_queue (RtecScheduler::OS_Priority priority,
+ int threads);
+ // Creates a name from the <priority> and tries to find a scheduling
+ // qos structure. If one is not found, but created, qos_ is set
+ // with default values. Either way, if qos_->thread_ > 0, it calls
+ // this->synch_threads. Otherwise, our message queue will use
+ // notification_strategy_. This will cause the ReactorEx to call
+ // back the dispatching_module_ when requests are queued on our
+ // message queue. Returns 0 on success, -1 on failure.
+#endif
+
+ virtual void threads_closed (void);
+ // Called when every thread has exited. This will call
+ // dispatching_module_->dispatch_queue_closed.
+
+private:
+ ACE_ES_Dispatching_Base *dispatching_module_;
+ // Used in threads_closed.
+
+ ACE_ES_Notification_Strategy *notification_strategy_;
+ // Notifies the Dispatching Module when a request has been queued on
+ // our message queue.
+};
+
+// ************************************************************
+
+class ACE_ES_Priority_Dispatching : public ACE_ES_Dispatching_Base
+// = TITLE
+// Event Service Priority Dispatching Module
+//
+// = DESCRIPTION
+// Inherits from ACE_Event_Handler to utilitize the
+// ACE_Message_Queue notification strategy. This implementation
+// does priority dispatching without preemption.
+{
+public:
+ ACE_ES_Priority_Dispatching (ACE_EventChannel *channel,
+ int threads_per_queue);
+ // Store <channel>. Spawns <threads_per_queue> thread for each
+ // dispatch queue. If != 0, then the channel is an MT_CHANNEL. If
+ // == 0, then the channel is an ST_CHANNEL.
+
+ ~ACE_ES_Priority_Dispatching (void);
+ // Delete queues.
+
+ void connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &);
+ // Allocate any needed dispatching resources for this consumers
+ // priority.
+
+ void disconnected (ACE_Push_Consumer_Proxy *consumer);
+ // Release unneeded dispatch queues.
+
+ // = Not needed.
+ // void connected (ACE_Push_Supplier_Proxy *supplier);
+ // void disconnecting (ACE_Push_Supplier_Proxy *supplier);
+
+ virtual void push (ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &);
+ // Enqueues the request on the appropriate Dispatch Queue.
+
+ virtual void shutdown (void);
+ // Closes all queues "asynchronously." When all queues are closed,
+ // deletes them all and then deletes itself.
+
+ virtual void dispatch_queue_closed (ACE_ES_Dispatch_Queue *q);
+ // Called when all the threads of a <q> have exited. Deletes <q>.
+
+ // virtual ACE_HANDLE get_handle (void) const;
+ // Get the I/O handle.
+
+protected:
+ virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
+ // Called when input has arrived on a message queue. This is used
+ // for single-threaded implementations.
+
+ virtual int handle_input (ACE_HANDLE);
+ // For single-threaded implementations on non-win32 platforms that
+ // use the ACE_Reactor_Notification_Strategy. This just forwards
+ // all calls to this->handle_signal ().
+
+ ACE_ES_Notification_Strategy notification_strategy_;
+ // Shared between all dispatch queues.
+
+ void initialize_queues (void);
+ // This is a hack to create a queue for each of the 4 rate groups.
+
+ ACE_ES_Dispatch_Queue *queues_[ACE_Scheduler_MAX_PRIORITIES];
+ // Pointers to dispatch queues.
+
+ ACE_ES_Dispatch_Queue *delete_me_queues_[ACE_Scheduler_MAX_PRIORITIES];
+ // Pointers to dispatch queues that want to die.
+
+ int queue_count_[ACE_Scheduler_MAX_PRIORITIES];
+ // The number of consumers using each queue.
+
+ int highest_priority_;
+ // The highest priority queue in queues_. This allows us to
+ // optimize the handle_signal method.
+
+ int shutdown_;
+ // Make sure to only shutdown the dispatching module once.
+
+ int threads_per_queue_;
+ // The number of threads to spawn for each dispatch queue.
+};
+
+// ************************************************************
+
+class ACE_ES_EFD_Dispatching : public ACE_ES_Dispatching_Base
+// = TITLE
+// Event Service EFD Dispatching Module
+//
+// = DESCRIPTION
+// Implements a zero-threaded dispatcher with no preemption.
+{
+public:
+ ACE_ES_EFD_Dispatching (ACE_EventChannel *channel);
+ // Acquires the proper qos structure and passes <channel> onto to
+ // the dispatching base constructor.
+
+ virtual void push (ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &);
+ // Forward up_.
+};
+
+// ************************************************************
+
+class ACE_ES_RTU_Dispatching : public ACE_ES_Priority_Dispatching
+// = TITLE
+// Event Service RTU Dispatching Module
+//
+// = DESCRIPTION
+// Implements a single-threaded dispatcher with delayed preemption.
+{
+public:
+ ACE_ES_RTU_Dispatching (ACE_EventChannel *channel);
+ // Store <channel>.
+
+ virtual int dispatch_event (ACE_ES_Dispatch_Request *request,
+ u_long &command_action);
+ // Called by ACE_Dispatch_Queues and handle_signal when an event
+ // needs to be dequeued. Implements an RTU-like delayed preemption
+ // policy.
+
+ virtual void push (ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &);
+ // Calls ACE_ES_Priority_Dispatching::push and then checks if
+ // preemption is necessary.
+};
+
+#if defined (__ACE_INLINE__)
+#include "Dispatching_Modules.i"
+#endif /* __ACE_INLINE__ */
+#endif /* ACE_DISPATCHING_MODULES_H */
+
+
diff --git a/TAO/local/bin/Event_Service/Dispatching_Modules.i b/TAO/local/bin/Event_Service/Dispatching_Modules.i
new file mode 100644
index 00000000000..8c75b08aab1
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Dispatching_Modules.i
@@ -0,0 +1,267 @@
+/* -*- C++ -*- */
+// $Id$
+
+ACE_INLINE
+ACE_ES_Dispatch_Request::ACE_ES_Dispatch_Request (void) :
+ priority_ (0),
+ rt_info_ (0),
+ dispatching_module_ (0),
+ use_single_event_ (0),
+ consumer_ (0),
+ single_event_ (),
+ event_set_ ()
+{
+}
+
+ACE_INLINE
+ACE_ES_Dispatch_Request::~ACE_ES_Dispatch_Request (void)
+{
+}
+
+ACE_INLINE
+ACE_ES_Dispatch_Request::ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ RtecScheduler::handle_t rt_info) :
+ priority_ (0),
+ rt_info_ (rt_info),
+ dispatching_module_ (0),
+ use_single_event_ (0),
+ consumer_ (consumer),
+ single_event_ (),
+ event_set_ ()
+{
+}
+
+ACE_INLINE
+ACE_ES_Dispatch_Request::ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ const Event_Set &event_set,
+ RtecScheduler::handle_t rt_info) :
+ priority_ (0),
+ rt_info_ (rt_info),
+ dispatching_module_ (0),
+ use_single_event_ (0),
+ consumer_ (consumer),
+ single_event_ (),
+ event_set_ (event_set)
+{
+}
+
+ACE_INLINE
+ACE_ES_Dispatch_Request::ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ ACE_ES_Event_Container *event,
+ RtecScheduler::handle_t rt_info) :
+ priority_ (0),
+ rt_info_ (rt_info),
+ dispatching_module_ (0),
+ use_single_event_ (0),
+ consumer_ (consumer),
+ single_event_ (),
+ event_set_ ()
+{
+ event_set_ += event;
+}
+
+ACE_INLINE
+ACE_ES_Dispatch_Request::ACE_ES_Dispatch_Request (ACE_Push_Consumer_Proxy *consumer,
+ const RtecEventComm::Time &time,
+ RtecScheduler::handle_t rt_info) :
+ priority_ (0),
+ rt_info_ (rt_info),
+ dispatching_module_ (0),
+ use_single_event_ (1),
+ consumer_ (consumer),
+ single_event_ (),
+ event_set_ ()
+{
+ single_event_.time_ = time;
+ single_event_.type_ = ACE_ES_EVENT_TIMEOUT;
+}
+
+ACE_INLINE void
+ACE_ES_Dispatch_Request::set (ACE_ES_Dispatching_Base *dispatching_module,
+ RtecScheduler::OS_Priority preemption_priority,
+ RtecScheduler::Sub_Priority sub_priority)
+{
+ dispatching_module_ = dispatching_module;
+ priority_ = preemption_priority;
+ ACE_Message_Block::msg_priority (sub_priority);
+}
+
+ACE_INLINE ACE_Push_Consumer_Proxy *
+ACE_ES_Dispatch_Request::consumer (void) const
+{
+ return consumer_;
+}
+
+ACE_INLINE const ACE_ES_Dispatch_Request::Event_Set &
+ACE_ES_Dispatch_Request::event_set (void) const
+{
+ return event_set_;
+}
+
+ACE_INLINE ACE_ES_Dispatch_Request::Event_Set &
+ACE_ES_Dispatch_Request::event_set (void)
+{
+ return event_set_;
+}
+
+ACE_INLINE CORBA::ULong
+ACE_ES_Dispatch_Request::number_of_events (void) const
+{
+ if (use_single_event_)
+ return 1;
+ else
+ return event_set_.length ();
+}
+
+ACE_INLINE RtecScheduler::OS_Priority
+ACE_ES_Dispatch_Request::priority (void)
+{
+ return priority_;
+}
+
+ACE_INLINE RtecScheduler::handle_t
+ACE_ES_Dispatch_Request::rt_info (void)
+{
+ return rt_info_;
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_ES_Dispatching_Base::ACE_ES_Dispatching_Base (ACE_EventChannel *channel)
+ : channel_ (channel),
+ thr_count_ (0),
+ up_ (0),
+ down_ (0)
+{
+}
+
+ACE_INLINE void
+ACE_ES_Dispatching_Base::open (ACE_ES_Consumer_Module *up,
+ ACE_ES_Correlation_Module *down)
+{
+ up_ = up;
+ down_ = down;
+ // 1 == 2.
+}
+
+ACE_INLINE void
+ACE_ES_Dispatching_Base::connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &_env)
+{
+ down_->connected (consumer, _env);
+}
+
+ACE_INLINE void
+ACE_ES_Dispatching_Base::disconnected (ACE_Push_Consumer_Proxy *consumer)
+{
+ // Do nothing.
+ ACE_UNUSED_ARG (consumer);
+}
+
+ACE_INLINE void
+ACE_ES_Dispatching_Base::disconnecting (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &_env)
+{
+ down_->disconnecting (consumer, _env);
+}
+
+ACE_INLINE void
+ACE_ES_Dispatching_Base::dispatch_queue_closed (ACE_ES_Dispatch_Queue *q)
+{
+ ACE_UNUSED_ARG (q);
+}
+
+// Just forward the request. This is basically a hook for the RTU
+// stuff.
+ACE_INLINE int
+ACE_ES_Dispatching_Base::dispatch_event (ACE_ES_Dispatch_Request *request,
+ u_long &command_action)
+{
+ ACE_TIMEPROBE ("decode the event");
+
+ ACE_TRY
+ {
+ // Forward the request.
+ up_->push (request, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Dispatching_Base::dispatch_event unknown exception.\n"));
+ }
+ ACE_ENDTRY;
+
+ // Tell our caller to release the request.
+ command_action = ACE_RT_Task_Command::RELEASE;
+
+ // Return zero so our calling thread does not exit.
+ return 0;
+}
+
+ACE_INLINE void
+ACE_ES_Dispatching_Base::shutdown (void)
+{
+ ACE_DEBUG ((LM_DEBUG, "(%t) ACE_ES_Dispatching_Base module shutting down.\n"));
+}
+
+// ************************************************************
+
+#if defined (ACE_WIN32)
+ACE_INLINE
+ACE_ES_ReactorEx_NS::ACE_ES_ReactorEx_NS (ACE_Event_Handler *eh)
+ : ACE_Notification_Strategy (eh, ACE_Event_Handler::NULL_MASK)
+{
+}
+
+ACE_INLINE int
+ACE_ES_ReactorEx_NS::open (void)
+{
+ return ACE_Task_Manager::instance ()->
+ GetReactorTask (0)->get_reactor ().register_handler (eh_, event_.handle ());
+}
+
+ACE_INLINE void
+ACE_ES_ReactorEx_NS::shutdown (void)
+{
+ ACE_Task_Manager::instance ()->GetReactorTask (0)->
+ get_reactor ().remove_handler (eh_, ACE_Event_Handler::DONT_CALL);
+}
+
+ACE_INLINE int
+ACE_ES_ReactorEx_NS::notify (void)
+{
+ return event_.signal ();
+}
+
+ACE_INLINE int
+ACE_ES_ReactorEx_NS::notify (ACE_Event_Handler *eh,
+ ACE_Reactor_Mask mask)
+{
+ return event_.signal ();
+}
+
+#else /* !defined (ACE_WIN32) */
+// This class is only necessary on non-win32 platforms.
+ACE_INLINE
+ACE_ES_Reactor_NS::ACE_ES_Reactor_NS (ACE_Event_Handler *eh)
+ : ACE_Reactor_Notification_Strategy (&(ACE_Task_Manager::instance ()->
+ GetReactorTask (0)->get_reactor ()),
+ eh, ACE_Event_Handler::READ_MASK)
+{
+}
+
+ACE_INLINE int
+ACE_ES_Reactor_NS::open (void)
+{
+ return 0;
+}
+
+ACE_INLINE void
+ACE_ES_Reactor_NS::shutdown (void)
+{
+}
+
+#endif /* ACE_WIN32 */
+
+// ************************************************************
diff --git a/TAO/local/bin/Event_Service/Event_Channel.cpp b/TAO/local/bin/Event_Service/Event_Channel.cpp
new file mode 100644
index 00000000000..dcb2c883bd7
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Event_Channel.cpp
@@ -0,0 +1,2986 @@
+// $Id$
+
+
+#include "ace/Service_Config.h"
+
+#include "Dispatching_Modules.h"
+#include "Memory_Pools.h"
+#include "Scheduler_Factory.h"
+#include "Event_Utilities.h"
+#include "Event_Channel.h"
+
+// These are to save space.
+#define WRITE_GUARD ACE_ES_WRITE_GUARD
+#define READ_GUARD ACE_ES_READ_GUARD
+
+#if !defined (__ACE_INLINE__)
+#include "Event_Channel.i"
+#endif /* __ACE_INLINE__ */
+
+// ************************************************************
+
+static RtecScheduler::OS_Priority
+Preemption_Priority (RtecScheduler::handle_t rtinfo)
+{
+ RtecScheduler::OS_Priority thread_priority;
+ RtecScheduler::Sub_Priority subpriority;
+ RtecScheduler::Preemption_Priority preemption_priority;
+
+ ACE_TRY
+ {
+ ACE_Scheduler_Factory::server ()->priority
+ (rtinfo,
+ thread_priority,
+ subpriority,
+ preemption_priority,
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV
+ }
+ ACE_CATCH (RtecScheduler::UNKNOWN_TASK, ex_ut)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "UNKNOWN_TASK %p.\n",
+ "Preemption_Priority"), 0);
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "Unexpected exception %p.\n",
+ "Preemption_Priority"), 0);
+
+ }
+ ACE_ENDTRY;
+ return preemption_priority;
+}
+
+static RtecScheduler::OS_Priority
+IntervalToPriority (RtecScheduler::Time interval)
+{
+ for (int x=0; x < ACE_Scheduler_MAX_PRIORITIES; x++)
+ if (interval <= ACE_Scheduler_Rates[x])
+ return x;
+
+ return ACE_Scheduler_MIN_PREEMPTION_PRIORITY;
+}
+
+// ************************************************************
+
+class Shutdown_Consumer : public ACE_ES_Dispatch_Request
+// = TITLE
+// Shutdown Consumer command
+//
+// = DESCRIPTION
+// This command object is sent through the system when a consumer
+// disconnects. When the Dispatching Module dequeues this request,
+// it calls execute which execute calls back to the Consumer
+// Module. At that point, the Consumer Module can tell the rest of
+// the system that the consumer has disconnected and delete the
+// consumer proxy. This allows all events queued for the consumer
+// to be flushed to the consumer proxy (which will drop them).
+// Events can be queued in the ReactorEx (in a dispatch set), or in
+// the Dispatching Module.
+{
+public:
+ // When executed, tells <consumer_module> that <consumer> has shut
+ // down.
+ Shutdown_Consumer (ACE_ES_Consumer_Module *consumer_module,
+ ACE_Push_Consumer_Proxy *consumer)
+ : consumer_module_ (consumer_module)
+ {
+ consumer_ = consumer;
+
+ // Set rt_info_ to the lowest priority rt_info in consumer_.
+ // This is so the dispatching module can query us as a dispatch
+ // request to get the appropriate preemption priority.
+ ACE_ES_Dependency_Iterator iter (consumer->qos ().dependencies);
+ while (iter.advance_dependency () == 0)
+ {
+ RtecEventComm::EventType &type = (*iter).event_.type_;
+ if (type != ACE_ES_GLOBAL_DESIGNATOR &&
+ type != ACE_ES_CONJUNCTION_DESIGNATOR &&
+ type != ACE_ES_DISJUNCTION_DESIGNATOR)
+ {
+ if (rt_info_ == 0 ||
+ ::Preemption_Priority ((*iter).rt_info) <
+ ::Preemption_Priority (rt_info_))
+ rt_info_ = (*iter).rt_info;
+ }
+ }
+ }
+
+ // Report to the consumer module that consumer_ has shutdown.
+ virtual int execute (u_long &command_action)
+ {
+ consumer_module_->shutdown_request (this);
+ command_action = ACE_RT_Task_Command::RELEASE;
+ return 0;
+ }
+
+ void *operator new (size_t /* nbytes */)
+ { return ::new char[sizeof (Shutdown_Consumer)]; }
+
+ void operator delete (void *buf)
+ { ::delete [] buf; }
+
+ // The module that we report to.
+ ACE_ES_Consumer_Module *consumer_module_;
+};
+
+// ************************************************************
+
+class Shutdown_Channel : public ACE_ES_Dispatch_Request
+{
+public:
+ Shutdown_Channel (ACE_EventChannel *channel) :
+ channel_ (channel) {}
+
+ // Report to the consumer module that consumer_ has shutdown.
+ virtual int execute (u_long &command_action)
+ {
+#if 0
+ channel_->destroy_i ();
+#endif
+ command_action = ACE_RT_Task_Command::RELEASE;
+ return 0;
+ }
+
+ void *operator new (size_t /* nbytes */)
+ { return ::new char[sizeof (Shutdown_Channel)]; }
+
+ void operator delete (void *buf)
+ { ::delete [] buf; }
+
+ ACE_EventChannel *channel_;
+};
+
+// ************************************************************
+
+class ACE_ES_Priority_Timer : public ACE_Event_Handler
+// = TITLE
+// Event Service Timer
+//
+// = DESCRIPTION
+// Manages a thread per priority, each of which sits on its own
+// ReactorEx dispatching the timers for its given priority.
+{
+public:
+ ACE_ES_Priority_Timer (void);
+ // Default construction.
+
+ int connected (RtecScheduler::handle_t rt_info);
+ // This allows the Priority Timer to prespawn threads. Returns 0 on
+ // success, -1 on failure.
+
+ int schedule_timer (RtecScheduler::handle_t rt_info,
+ const ACE_ES_Timer_ACT *act,
+ RtecScheduler::OS_Priority preemption_priority,
+ RtecScheduler::Time delta,
+ RtecScheduler::Time interval = 0);
+ // Schedule a timer at the appropriate priority for <preemption_priority>.
+ // Returns the preemption priority used on success, -1 on failure.
+
+ int cancel_timer (RtecScheduler::OS_Priority preemption_priority,
+ int id, ACE_ES_Timer_ACT *&act);
+ // Cancel the timer associated with the priority of
+ // <preemption_priority> and <id>. <act> is filled in with the
+ // Timer_ACT used when scheduling the timer. Returns 0 on success,
+ // -1 on failure.
+
+private:
+ virtual int handle_timeout (const ACE_Time_Value &tv,
+ const void *act);
+ // Casts <act> to ACE_ES_Timer_ACT and calls execute.
+};
+
+// ************************************************************
+
+class Flush_Queue_ACT : public ACE_ES_Timer_ACT
+// = TITLE
+// Flush Queue Asynchronous Completion Token
+//
+// = DESCRIPTION
+// Carries a single dispatch request through the ReactorEx.
+// Deletes itself when execute is called.
+{
+public:
+ Flush_Queue_ACT (ACE_ES_Dispatch_Request *request,
+ ACE_ES_Dispatching_Module *dispatching_module) :
+ request_ (request),
+ dispatching_module_ (dispatching_module) { }
+
+ virtual void execute (void)
+ {
+ ACE_TRY
+ {
+ ACE_ES_Dispatch_Request *request = request_;
+ dispatching_module_->push (request, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ delete this;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) Flush_Queue_ACT::execute: "
+ "Unknown exception..\n"));
+ }
+ ACE_ENDTRY;
+ }
+
+ ACE_ES_Dispatch_Request *request_;
+ ACE_ES_Dispatching_Module *dispatching_module_;
+};
+
+// ************************************************************
+
+// Since this class is *defined* in the cpp file, the INLINE
+// definitions must also be in the cpp file. The should go here
+// before any use of these methods.
+
+ACE_INLINE int
+ACE_ES_Priority_Timer::schedule_timer (RtecScheduler::handle_t rt_info,
+ const ACE_ES_Timer_ACT *act,
+ RtecScheduler::OS_Priority preemption_priority,
+ RtecScheduler::Time delta,
+ RtecScheduler::Time interval)
+{
+ if (rt_info != 0)
+ {
+ // Add the timer to the task's dependency list.
+ RtecScheduler::handle_t timer_rtinfo =
+ ACE_Task_Manager::instance()->GetReactorTask (preemption_priority)->rt_info ();
+
+ ACE_TRY
+ {
+ ACE_Scheduler_Factory::server()->add_dependency
+ (rt_info, timer_rtinfo, 1, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ ACE_DEBUG ((LM_ERROR, "ACE_ES_Priority_Timer::schedule_timer - "
+ "add_dependency (%d,%d,%d)\n",
+ rt_info, timer_rtinfo, 1));
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "add dependency failed"));
+ }
+ ACE_ENDTRY;
+ }
+
+ // @@ We're losing resolution here.
+ ACE_Time_Value tv_delta;
+ tv_delta.usec (delta / 10);
+ if (tv_delta.usec () == 0)
+ tv_delta.usec (1);
+
+ ACE_Time_Value tv_interval;
+ if (interval > 0)
+ {
+ tv_interval.usec (interval / 10);
+ if (tv_interval.usec () == 0)
+ tv_interval.usec (1);
+ }
+
+ return ACE_Task_Manager::instance()->
+ GetReactorTask (preemption_priority)->
+ get_reactor ().schedule_timer (this,
+ (void *) act,
+ tv_delta, tv_interval);
+}
+
+ACE_INLINE int
+ACE_ES_Priority_Timer::cancel_timer (RtecScheduler::OS_Priority preemption_priority,
+ int id, ACE_ES_Timer_ACT *&act)
+{
+ const void *vp;
+
+ int result = ACE_Task_Manager::instance()->
+ GetReactorTask (preemption_priority)->
+ get_reactor ().cancel_timer (id, &vp);
+
+ if (result == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Priority_Timer::cancel_timer: "
+ "Tried to cancel nonexistent timer.\n"));
+ act = 0;
+ }
+ else
+ act = (ACE_ES_Timer_ACT *) vp;
+
+ return result;
+}
+
+// ************************************************************
+
+ACE_ES_Event_Container::ACE_ES_Event_Container (void) :
+ // ACE_ES_Event (),
+ ref_count_ (1)
+{
+}
+
+ACE_ES_Event_Container::~ACE_ES_Event_Container (void)
+{
+}
+
+ACE_ES_Event_Container::ACE_ES_Event_Container (const ACE_ES_Event_Container &ec)
+ : RtecEventComm_Event (ec),
+ ref_count_ (1)
+{
+}
+
+ACE_ES_Event_Container::ACE_ES_Event_Container (const RtecEventComm_Event &e)
+ : RtecEventComm_Event (e),
+ ref_count_ (1)
+{
+}
+
+ACE_ES_Event_Container *
+ACE_ES_Event_Container::_duplicate (void)
+{
+ ref_count_++;
+ return this;
+}
+
+void
+ACE_ES_Event_Container::_release (void)
+{
+ if (--ref_count_ == 0)
+ delete this;
+}
+
+int
+ACE_ES_Event_Container::operator== (const ACE_ES_Event_Container &event)
+{
+ RtecEventComm::Event &event1 = (RtecEventComm::Event &) *this;
+ RtecEventComm::Event &event2 = (RtecEventComm::Event &) event;
+ return event1 == event2;
+}
+
+void *
+ACE_ES_Event_Container::operator new (size_t nbytes)
+{
+ ACE_ASSERT (nbytes <= sizeof (ACE_ES_Event_Container));
+ return ACE_ES_Memory_Pools::new_Event_Container ();
+}
+
+void
+ACE_ES_Event_Container::operator delete (void *mem)
+{
+ ACE_ES_Memory_Pools::delete_Event_Container (mem);
+}
+
+void
+ACE_ES_Event_Container::dump (void)
+{
+ ::dump_event ((RtecEventComm::Event &) *this);
+}
+
+// ************************************************************
+
+ACE_Push_Supplier_Proxy::ACE_Push_Supplier_Proxy (ACE_ES_Supplier_Module *sm)
+ : supplier_module_ (sm),
+ me_ (this),
+ push_supplier_ (0)
+{
+}
+
+void
+ACE_Push_Supplier_Proxy::connect_push_supplier (RtecEventComm::PushSupplier_ptr push_supplier,
+ const RtecEventChannelAdmin::SupplierQOS &qos,
+ CORBA::Environment &_env)
+{
+ if (this->connected ())
+ ACE_THROW (RtecEventChannelAdmin::AlreadyConnected);
+
+ push_supplier_ =
+ RtecEventComm::PushSupplier::_duplicate(push_supplier);
+
+ // ACE_SupplierQOS_Factory::debug (qos);
+
+ // Copy by value.
+ qos_ = qos;
+
+ // ACE_SupplierQOS_Factory::debug (qos_);
+
+ // @@ TODO: The SupplierQOS should have a more reasonable interface to
+ // obtain the supplier_id(), BTW, a callback to push_supplier will
+ // not work: it usually results in some form of dead-lock.
+ source_id_ = qos_.publications_[0].event_.source_;
+
+ supplier_module_->connected (this, _env);
+}
+
+void
+ACE_Push_Supplier_Proxy::push (const RtecEventComm::EventSet &event,
+ CORBA::Environment &_env)
+{
+ if (!this->connected ())
+ ACE_THROW (RtecEventComm::Disconnected);
+
+ supplier_module_->push (this, event, _env);
+}
+
+void
+ACE_Push_Supplier_Proxy::disconnect_push_consumer (CORBA::Environment &_env)
+{
+ if (this->connected ())
+ {
+ push_supplier_ = 0;
+ supplier_module_->disconnecting (this, _env);
+ }
+}
+
+void
+ACE_Push_Supplier_Proxy::shutdown (void)
+{
+ ACE_TRY
+ {
+ push_supplier_->disconnect_push_supplier (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_Push_Supplier_Proxy::shutdown failed.\n"));
+ }
+ ACE_ENDTRY;
+}
+
+// ************************************************************
+
+ACE_Push_Consumer_Proxy::ACE_Push_Consumer_Proxy (ACE_ES_Consumer_Module *cm)
+ : me_ (this),
+ push_consumer_ (0),
+ consumer_module_ (cm)
+{
+}
+
+ACE_Push_Consumer_Proxy::~ACE_Push_Consumer_Proxy (void)
+{
+}
+
+
+void
+ACE_Push_Consumer_Proxy::connect_push_consumer (RtecEventComm::PushConsumer_ptr push_consumer,
+ const RtecEventChannelAdmin::ConsumerQOS &qos,
+ CORBA::Environment &_env)
+{
+ if (this->connected ())
+ ACE_THROW (RtecEventChannelAdmin::AlreadyConnected);
+
+ push_consumer_ =
+ RtecEventComm::PushConsumer::_duplicate(push_consumer);
+ // @@ TODO Find out why are two duplicates needed...
+ RtecEventComm::PushConsumer::_duplicate(push_consumer);
+
+ // ACE_ConsumerQOS_Factory::debug (qos);
+
+ // Copy by value.
+ qos_ = qos;
+
+ // ACE_ConsumerQOS_Factory::debug (qos_);
+
+ consumer_module_->connected (this, _env);
+}
+
+void
+ACE_Push_Consumer_Proxy::disconnect_push_supplier (CORBA::Environment &_env)
+{
+ consumer_module_->disconnecting (this, _env);
+ push_consumer_ = 0;
+}
+
+void
+ACE_Push_Consumer_Proxy::suspend (CORBA::Environment &)
+{
+ correlation_.suspend ();
+}
+
+void
+ACE_Push_Consumer_Proxy::resume (CORBA::Environment &)
+{
+ correlation_.resume ();
+}
+
+void
+ACE_Push_Consumer_Proxy::shutdown (void)
+{
+ ACE_TRY
+ {
+ push_consumer_->disconnect_push_consumer (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_Push_Consumer_Proxy::shutdown failed.\n"));
+ }
+ ACE_ENDTRY;
+}
+
+// ************************************************************
+
+ACE_EventChannel::ACE_EventChannel (u_long type)
+ : POA_RtecEventChannelAdmin::EventChannel ("EventChannel"),
+ rtu_manager_ (0),
+ type_ (type),
+ state_ (INITIAL_STATE),
+ me_ (this),
+ destroyed_ (0)
+{
+ consumer_module_ = new ACE_ES_Consumer_Module (this);
+ // RtecEventChannelAdmin::ConsumerAdmin_duplicate(consumer_module_);
+
+#if defined(ACE_ES_LACKS_ORB)
+ UPSSingleProcessorOrb_startup(type,
+ dispatching_module,
+ rtu_active,
+ rtu_manager);
+#else
+ ACE_NEW(dispatching_module_,
+ ACE_ES_Priority_Dispatching(this, THREADS_PER_DISPATCH_QUEUE));
+#endif
+
+ correlation_module_ = new ACE_ES_Correlation_Module (this);
+ subscription_module_ = new ACE_ES_Subscription_Module (this);
+ supplier_module_ = new ACE_ES_Supplier_Module (this);
+ timer_ = new ACE_ES_Priority_Timer;
+
+ consumer_module_->open (dispatching_module_);
+ dispatching_module_->open (consumer_module_, correlation_module_);
+ correlation_module_->open (dispatching_module_, subscription_module_);
+ subscription_module_->open (correlation_module_, supplier_module_);
+ supplier_module_->open (subscription_module_);
+}
+
+ACE_EventChannel::~ACE_EventChannel (void)
+{
+ ACE_DEBUG ((LM_DEBUG, "(%t) ACE_EventChannel deleting all modules.\n"));
+
+ ACE_TRY
+ {
+ this->destroy (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_EventChannel::~ACE_EventChannel"));
+ }
+ ACE_ENDTRY;
+ // @@ TODO: Shouldn't we use _release() instead?
+ delete rtu_manager_;
+ delete consumer_module_;
+ delete dispatching_module_;
+ delete correlation_module_;
+ delete subscription_module_;
+ delete supplier_module_;
+ delete timer_;
+}
+
+void
+ACE_EventChannel::destroy (CORBA::Environment &_env)
+{
+ ACE_UNUSED_ARG (_env);
+
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR ((LM_ERROR, "ACE_EventChannel::destroy"));
+
+ if (destroyed_ != 0)
+ return;
+
+ destroyed_ = 1;
+ ACE_DEBUG ((LM_DEBUG, "(%t) Event Channel shutting down.\n"));
+
+ // Send a shutdown message through the modules.
+ supplier_module_->shutdown ();
+
+#if 0
+ // Flush all messages in the channel.
+ Shutdown_Channel *sc = new Shutdown_Channel (this);
+ if (sc == 0)
+ ACE_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ // @@ TODO: Orbix parameters
+ // (0, CORBA::COMPLETED_NO, "ACE_EventChannel::destroy"));
+
+ // Create a wrapper around the dispatch request.
+ Flush_Queue_ACT *act = new Flush_Queue_ACT (sc, dispatching_module_);
+ if (act == 0)
+ ACE_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ // @@ TODO Orbix parameters
+ // (0, CORBA::COMPLETED_NO, "ACE_EventChannel::destroy"));
+
+ // Set a 100ns timer.
+ if (this->timer ()->schedule_timer (0, // no rt-info
+ act,
+ ACE_Scheduler_MIN_PREEMPTION_PRIORITY,
+ 100, // 10 usec delta
+ 0) == -1) // no interval
+ {
+ ACE_ERROR ((LM_ERROR, "%p queue_request failed.\n", "ACE_ES_Consumer_Module"));
+ delete sc;
+ delete act;
+ }
+#endif
+}
+
+void
+ACE_EventChannel::shutdown (void)
+{
+ // @@ TODO: Find a portable way to shutdown the ORB, on Orbix we have
+ // to call deactive_impl () on a CORBA::POA is that the portable
+ // way?
+ // With TAO we need access to the ORB (to call shutdown() on it).
+}
+
+void
+ACE_EventChannel::report_connect (u_long event)
+{
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR ((LM_ERROR, "ACE_EventChannel::report_connect"));
+
+ ACE_CLR_BITS (state_, event);
+}
+
+void
+ACE_EventChannel::report_disconnect (u_long event)
+{
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR ((LM_ERROR, "ACE_EventChannel::report_disconnect"));
+
+ ACE_SET_BITS (state_, event);
+ if (state_ == SHUTDOWN)
+ ACE_DEBUG ((LM_DEBUG, "(%t) Event Channel has no consumers or suppliers.\n"));
+}
+
+// ************************************************************
+
+ACE_ES_Subscription_Info::~ACE_ES_Subscription_Info (void)
+{
+ Subscriber_Map_Iterator iter (type_subscribers_);
+
+ // Delete all type collections.
+ for (Subscriber_Map_Entry *temp = 0;
+ iter.next (temp) != 0;
+ iter.advance ())
+ {
+ delete temp->int_id_;
+ }
+}
+
+/*
+void
+ACE_ES_Subscription_Info::Type_Subscribers::operator=
+(const ACE_ES_Subscription_Info::Type_Subscribers &rhs)
+{
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator iter (rhs.subscribers_);
+
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ iter.next (consumer) != 0;
+ iter.advance ())
+ {
+ if (subscribers_.insert (consumer) != 0)
+ ACE_ERROR ((LM_ERROR, "%p insert failed.\n",
+ "ACE_ES_Subscription_Info::Type_Subscribers::operator="));
+ }
+
+ // Pointer copy.
+ dependency_info_ = rhs.dependency_info_;
+}
+*/
+
+// Remove <consumer> from the consumer set in <type_map> set
+// corresponding to <type>.
+int
+ACE_ES_Subscription_Info::remove (Subscriber_Map &type_map,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type)
+{
+ Type_Subscribers *subscribers;
+
+ // Find the type set within the type collection.
+ if (type_map.find (type, subscribers) == -1)
+ // type_map does not contain the type.
+ return -1;
+
+ // Remove the consumer from the type set.
+ if (subscribers->consumers_.remove (consumer) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p remove failed.\n",
+ "ACE_ES_Subscriber_Info::remove"), -1);
+ // @@ Should probably remove the supplier from the consumers caller
+ // list.
+
+ // If the set is empty, remove it from the type collection.
+ if (subscribers->consumers_.size () == 0)
+ {
+ Type_Subscribers *removed_subscribers;
+ if (type_map.unbind (type, removed_subscribers) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p unbind failed.\n",
+ "ACE_ES_Subscriber_Info::remove"), -1);
+
+ // Sanity check.
+ if (removed_subscribers != subscribers)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Subscriber_Info::remove: "
+ "removed wrong set!\n"), -1);
+
+ // Free up the set removed.
+ delete removed_subscribers;
+ }
+
+ return 0;
+}
+
+
+int
+ACE_ES_Subscription_Info::remove (SourceID_Map &source_subscribers,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID sid)
+{
+ Subscriber_Set *subscribers;
+
+ // Find the subscribers of <sid>.
+ if (source_subscribers.find (sid, subscribers) == -1)
+ // does not contain the <sid>.
+ return -1;
+
+ // Remove the consumer from the subscriber set.
+ if (subscribers->remove (consumer) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p remove failed.\n",
+ "ACE_ES_Subscriber_Info::remove"), -1);
+ // @@ Should probably remove the supplier from the consumers caller
+ // list.
+
+ // If the set is empty, remove it from the type collection.
+ if (subscribers->size () == 0)
+ {
+ Subscriber_Set *removed_subscribers;
+ if (source_subscribers.unbind (sid, removed_subscribers) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p unbind failed.\n",
+ "ACE_ES_Subscriber_Info::remove"), -1);
+
+ // Sanity check.
+ if (removed_subscribers != subscribers)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Subscriber_Info::remove: "
+ "removed wrong set!\n"), -1);
+
+ // Free up the set removed.
+ delete removed_subscribers;
+ }
+
+ return 0;
+}
+
+
+void
+ACE_ES_Subscription_Info::append_subscribers (Subscriber_Set &dest,
+ Subscriber_Set &src)
+{
+ Subscriber_Set_Iterator src_iter (src);
+
+ // Iterate through the source set. Add each source proxy to the
+ // destination set.
+ for (ACE_ES_Consumer_Rep **proxy = 0;
+ src_iter.next (proxy) != 0;
+ src_iter.advance ())
+ {
+ if (dest.insert (*proxy) == -1)
+ ACE_ERROR ((LM_ERROR, "%p: insert failed.\n", "append_subscribers"));
+ }
+}
+
+int
+ACE_ES_Subscription_Info::insert_or_allocate (SourceID_Map &sid_map,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID sid)
+{
+ Subscriber_Set *subscribers;
+
+ if (sid_map.find (sid, subscribers) == -1)
+ {
+ // If the correct type set does not exist, make one with a null
+ // dependency info (since there is no supplier of this event).
+ subscribers = new Subscriber_Set;
+
+ if (sid_map.bind (sid, subscribers) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p bind failed.\n",
+ "ACE_ES_Subscription_Info::insert_or_allocate"));
+ delete subscribers;
+ return -1;
+ }
+ }
+
+ // 0 and 1 are success for insert.
+ return subscribers->insert (consumer) == -1 ? -1 : 0;
+}
+
+int
+ACE_ES_Subscription_Info::insert_or_allocate (Subscriber_Map &type_map,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type)
+{
+ Type_Subscribers *subscribers;
+
+ if (type_map.find (type, subscribers) == -1)
+ {
+ // If the correct type set does not exist, make one with a null
+ // dependency info (since there is no supplier of this event).
+ subscribers = new Type_Subscribers (0);
+
+ if (type_map.bind (type, subscribers) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p bind failed.\n",
+ "ACE_ES_Subscription_Info::insert_or_allocate"));
+ delete subscribers;
+ return -1;
+ }
+ }
+
+ return subscribers->consumers_.insert (consumer);
+}
+
+int
+ACE_ES_Subscription_Info::insert_or_fail (Subscriber_Map &type_map,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type,
+ RtecScheduler::Dependency_Info *&dependency)
+{
+ Type_Subscribers *subscribers;
+
+ // Get the subscriber set for <type>.
+ if (type_map.find (type, subscribers) == -1)
+ return -1;
+
+ // Pass back the description of the method generating <type>.
+ dependency = subscribers->dependency_info_;
+
+ // Insert the new consumer into the subscriber set.
+ return subscribers->consumers_.insert (consumer);
+}
+
+// ************************************************************
+
+typedef ACE_EventChannel::SYNCHRONIZATION_ERROR SYNC_ERROR;
+typedef ACE_EventChannel::QOS_ERROR QOS_ERROR;
+typedef ACE_EventChannel::SUBSCRIPTION_ERROR SUBSCRIPTION_ERROR;
+typedef ACE_EventChannel::CORRELATION_ERROR CORRELATION_ERROR;
+
+// ************************************************************
+
+ACE_ES_Consumer_Module::ACE_ES_Consumer_Module (ACE_EventChannel* channel)
+ : lock_ (),
+ all_consumers_ (),
+ channel_ (channel),
+ me_ (this),
+ down_ (0)
+{
+}
+
+void
+ACE_ES_Consumer_Module::open (ACE_ES_Dispatching_Module *down)
+{
+ down_ = down;
+}
+
+void
+ACE_ES_Consumer_Module::connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &_env)
+{
+ channel_->report_connect (ACE_EventChannel::CONSUMER);
+ down_->connected (consumer, _env);
+}
+
+void
+ACE_ES_Consumer_Module::shutdown_request (ACE_ES_Dispatch_Request *request)
+{
+ Shutdown_Consumer *sc = (Shutdown_Consumer *) request;
+
+ // Tell everyone else that the consumer is disconnected. This means
+ // that *nothing* is left in the system for the consumer, so
+ // everyone can free up any resources.
+ down_->disconnected (sc->consumer ());
+
+ ACE_DEBUG ((LM_DEBUG, "Deleting proxy for %s.\n",
+ ::ACE_ES_Consumer_Name (sc->consumer ()->qos ())));
+
+ // Delete the consumer proxy.
+ delete sc->consumer ();
+
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ return;
+
+ // Tell the channel that we may need to shut down.
+ if (all_consumers_.size () <= 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) No more consumers connected.\n"));
+ channel_->report_disconnect (ACE_EventChannel::CONSUMER);
+ }
+}
+
+void
+ACE_ES_Consumer_Module::shutdown (void)
+{
+ Consumers copy;
+
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ goto DONE;
+
+ if (all_consumers_.size () == 0)
+ goto DONE;
+
+ // Make a copy so that the consumers can disconnect without the
+ // lock being held.
+ copy = all_consumers_;
+ }
+
+ // This scope is just to thwart the compiler. It was complaining
+ // about the above goto's bypassing variable initializations. Yadda
+ // yadda.
+ {
+ Consumer_Iterator iter (copy);
+
+ CORBA::Environment env;
+
+ for (ACE_Push_Consumer_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ (*proxy)->shutdown ();
+ CORBA::release (*proxy);
+ // Shouldn't this be _release ()
+
+ // Remove the consumer from our list.
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR ((LM_ERROR, "%p Failed to acquire lock.\n", "ACE_ES_Consumer_Module::shutdown"));
+
+ if (all_consumers_.remove (*proxy) == -1)
+ ACE_ERROR ((LM_ERROR, "%p Failed to remove consumer.\n", "ACE_ES_Consumer_Module::shutdown"));
+ }
+ }
+ }
+
+DONE:
+ channel_->shutdown ();
+}
+
+void
+ACE_ES_Consumer_Module::disconnecting (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &_env)
+{
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_THROW (SYNC_ERROR);
+ // @@ TODO Orbix parameters
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Consumer_Module::disconnected"));
+
+ if (all_consumers_.remove (consumer) == -1)
+ return;
+ }
+
+ // Tell everyone else that the consumer is disconnecting. This
+ // allows them to remove the consumer from any subscription lists
+ // etc. However, messages may still be queued in the ReactorEx or
+ // in the Dispatching Module for this consumer, so no queues or
+ // proxies can be deleted just yet.
+ down_->disconnecting (consumer, _env);
+
+ // Send a shutdown message through the system. When this is
+ // dispatched, the consumer proxy will be deleted. <request> is
+ // queued in the Priority_Timer at <priority> level. It will be
+ // scheduled for dispatching in 1 nanosecond. This gives components
+ // a hook into the first queueing point in the channel.
+
+ // Create a shutdown message. When this is dispatched, it will
+ // delete the proxy.
+ Shutdown_Consumer *sc = new Shutdown_Consumer (this, consumer);
+ if (sc == 0)
+ ACE_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Consumer_Module::disconnected"));
+
+ // Create a wrapper around the dispatch request.
+ Flush_Queue_ACT *act = new Flush_Queue_ACT (sc, channel_->dispatching_module_);
+ if (act == 0)
+ ACE_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Consumer_Module::disconnecting"));
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) initiating consumer disconnect for %s.\n",
+ ::ACE_ES_Consumer_Name (consumer->qos ())));;
+
+ // Set a 100ns timer.
+ if (channel_->timer ()->schedule_timer (0, // no rt_info
+ act,
+ // ::Preemption_Priority (consumer->qos ().rt_info_),
+ ACE_Scheduler_MIN_PREEMPTION_PRIORITY,
+ 100, 0) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p queue_request failed.\n", "ACE_ES_Consumer_Module"));
+ delete sc;
+ delete act;
+ }
+}
+
+// This method executes in the same thread of control that will hand
+// the event set to the consumer (or it's proxy). A network proxy may
+// copy the event set to the network buffer. An active client may
+// copy the event set to be queued. Or a same address-space consumer
+// can read the set we allocated off the stack.
+void
+ACE_ES_Consumer_Module::push (const ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &_env)
+{
+ // We'll create a temporary event set with the size of the incoming
+ // request.
+ RtecEventComm::EventSet event_set (request->number_of_events ());
+ request->make_copy (event_set);
+
+ // Forward the event set.
+ request->consumer ()->push (event_set, _env);
+}
+
+RtecEventChannelAdmin::ProxyPushSupplier_ptr
+ACE_ES_Consumer_Module::obtain_push_supplier (CORBA::Environment &_env)
+{
+ ACE_Push_Consumer_Proxy *new_consumer = new ACE_Push_Consumer_Proxy (this);
+
+ // Get a new supplier proxy object.
+ if (new_consumer == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_EventChannel"
+ "::obtain_push_supplier failed.\n"));
+ ACE_THROW_RETURN (CORBA::NO_MEMORY (CORBA::COMPLETED_NO), 0);
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Consumer_Module::obtain_push_supplier"));
+ }
+
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ {
+ delete new_consumer;
+ ACE_THROW_RETURN (SYNC_ERROR, 0);
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO,
+ // "ACE_ES_Consumer_Module::obtain_push_supplier"), 0);
+ }
+
+ if (all_consumers_.insert (new_consumer) == -1)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Consumer_Module insert failed.\n"));
+ }
+
+ // Return the CORBA object reference to the new supplier proxy.
+ return new_consumer->get_ref ();
+}
+
+// ************************************************************
+
+ACE_ES_Correlation_Module::ACE_ES_Correlation_Module (ACE_EventChannel *channel)
+ : channel_ (channel),
+ up_ (0),
+ subscription_module_ (0)
+{
+}
+
+void
+ACE_ES_Correlation_Module::open (ACE_ES_Dispatching_Module *up,
+ ACE_ES_Subscription_Module *sm)
+{
+ up_ = up;
+ subscription_module_ = sm;
+}
+
+void
+ACE_ES_Correlation_Module::connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &_env)
+{
+ // Initialize the consumer correlation filter.
+ if (consumer->correlation ().connected (consumer, this) == -1)
+ ACE_THROW (CORRELATION_ERROR);
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Correlation_Module::connected"));
+}
+
+void
+ACE_ES_Correlation_Module::disconnecting (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &)
+{
+ if (consumer->correlation ().disconnecting () == -1)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Correlation_Module::disconnecting failed.\n"));
+}
+
+int
+ACE_ES_Correlation_Module::subscribe (ACE_ES_Consumer_Rep *consumer)
+{
+ return subscription_module_->subscribe (consumer);
+}
+
+/*
+int
+ACE_ES_Correlation_Module::unsubscribe (ACE_ES_Consumer_Rep *cr)
+{
+ return subscription_module_->unsubscribe (cr);
+}
+*/
+
+void
+ACE_ES_Correlation_Module::push (ACE_ES_Consumer_Rep *consumer,
+ ACE_ES_Event_Container *event,
+ CORBA::Environment &_env)
+{
+ ACE_TIMEPROBE ("enter ACE_ES_Correlation_Module::push");
+ ACE_ES_Dispatch_Request *request =
+ consumer->correlation ()->push (consumer, event);
+ ACE_TIMEPROBE (" pushed to Correlation_Module");
+
+ // If request == 0, then the event was queued for later. Otherwise,
+ // we need to push the event now.
+ if (request != 0)
+ up_->push (request, _env);
+
+ ACE_TIMEPROBE (" push_source_type: Dispatch Module enqueuing");
+}
+
+// Must check consumer->qos ().use_timeout () before calling this.
+// This method is supposed properly schedule a timer with respect to
+// the consumer's priority AND the correlation that should receive the
+// timeout event.
+int
+ACE_ES_Correlation_Module::schedule_timeout (ACE_ES_Consumer_Rep_Timeout *consumer)
+{
+ RtecEventComm::Time &interval = consumer->dependency ()->event_.time_;
+ RtecEventComm::Time &delay = consumer->dependency ()->event_.time_;
+
+ // Store the preemption priority so we can cancel the correct timer.
+ // The priority values may change during the process lifetime (e.g.,
+ // after the scheduler has been run).
+ consumer->preemption_priority (::IntervalToPriority (interval));
+
+ // Register the timer.
+ int id = channel_->timer ()->schedule_timer (consumer->dependency ()->rt_info,
+ consumer,
+ consumer->preemption_priority (),
+ delay, interval);
+
+ // Store the timer id for canceling.
+ consumer->timer_id (id);
+
+ if (id == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p schedule timer failed.\n",
+ "ACE_ES_Correlation_Module::schedule_timeout"), -1);
+
+ return 0;
+}
+
+// Must check consumer->qos ().timeout_ before calling this.
+int
+ACE_ES_Correlation_Module::cancel_timeout (ACE_ES_Consumer_Rep_Timeout *consumer)
+{
+ // Cancel the timer from the Priority Timer.
+ ACE_ES_Timer_ACT *act;
+ channel_->timer ()->cancel_timer (consumer->preemption_priority (),
+ consumer->timer_id (),
+ act);
+
+ ACE_ASSERT (consumer == act);
+
+ // Free up the Timer ACT.
+ // delete act;
+
+ return 0;
+}
+
+
+int
+ACE_ES_Correlation_Module::reschedule_timeout (ACE_ES_Consumer_Rep_Timeout *consumer)
+{
+ if (this->cancel_timeout (consumer) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "ACE_ES_Disjunction_Group::reschedule_deadline"), -1);
+ else
+ {
+ RtecEventComm::Time &interval = consumer->dependency ()->event_.time_;
+ RtecEventComm::Time &delay = consumer->dependency ()->event_.time_;
+
+ // Store the preemption priority so we can cancel the correct timer.
+ // The priority values may change during the process lifetime (e.g.,
+ // after the scheduler has been run).
+ consumer->preemption_priority (::IntervalToPriority (interval));
+
+ // Register the timer.
+ int id = channel_->timer ()->schedule_timer (0, // Do not pass an RT_Info.
+ consumer,
+ consumer->preemption_priority (),
+ delay, interval);
+
+ // Store the timer id for canceling.
+ consumer->timer_id (id);
+
+ if (id == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p schedule timer failed.\n",
+ "ACE_ES_Correlation_Module::reschedule_timeout"), -1);
+
+ return 0;
+ }
+}
+
+void
+ACE_ES_Correlation_Module::shutdown (void)
+{
+ // Perhaps this should call disconnecting on all the consumers?
+ // We'll opt to just forward this message for now.
+ up_->shutdown ();
+}
+
+// ************************************************************
+
+ACE_ES_Consumer_Correlation::ACE_ES_Consumer_Correlation (void) :
+ correlation_module_ (0),
+ type_id_index_ (0),
+ channel_ (0),
+ forwarding_rt_info_ (0),
+ qos_ (),
+ pending_events_ (0),
+ lock_ (),
+ consumer_ (0),
+ pending_flags_ (0),
+ consumer_reps_ (0),
+ n_consumer_reps_ (0),
+ timer_reps_ (0),
+ n_timer_reps_ (0),
+ conjunction_groups_ (0),
+ n_conjunction_groups_ (0),
+ disjunction_groups_ (0),
+ n_disjunction_groups_ (0),
+ connected_ (0)
+{
+}
+
+ACE_ES_Consumer_Correlation::~ACE_ES_Consumer_Correlation (void)
+{
+ delete [] timer_reps_;
+ for (int cr = 0; cr < n_consumer_reps_; cr++)
+ consumer_reps_[cr]->_release ();
+ delete [] consumer_reps_;
+ delete [] conjunction_groups_;
+ delete [] disjunction_groups_;
+ delete [] pending_events_;
+}
+
+void
+ACE_ES_Consumer_Correlation::disconnect_push_supplier (CORBA::Environment &)
+{
+ connected_ = 0;
+}
+
+int
+ACE_ES_Consumer_Correlation::allocate_correlation_resources (ACE_ES_Dependency_Iterator &iter)
+{
+ n_conjunction_groups_ = iter.n_conjunctions ();
+ if (n_conjunction_groups_ > 0)
+ {
+ conjunction_groups_ = new ACE_ES_Conjunction_Group[n_conjunction_groups_];
+ if (conjunction_groups_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "ACE_ES_Consumer_Correlation::connected"), -1);
+ for (int n=0; n < n_conjunction_groups_; n++)
+ conjunction_groups_[n].set_correlation_module (correlation_module_);
+ }
+
+ n_disjunction_groups_ = iter.n_disjunctions ();
+ if (n_disjunction_groups_ > 0)
+ {
+ disjunction_groups_ = new ACE_ES_Disjunction_Group[n_disjunction_groups_];
+ if (disjunction_groups_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "ACE_ES_Consumer_Correlation::connected"), -1);
+ for (int n=0; n < n_disjunction_groups_; n++)
+ disjunction_groups_[n].set_correlation_module (correlation_module_);
+ }
+
+ n_consumer_reps_ = iter.n_events ();
+ if (n_consumer_reps_ > 0)
+ {
+ // This allocates more than is needed if there are repeats:
+ // (A+B)|(B+C). We allocate these individually so that they can
+ // be deleted individually.
+
+ typedef ACE_ES_Consumer_Rep *reparray;
+ consumer_reps_ = new reparray[n_consumer_reps_];
+
+ for (int cr = 0; cr < n_consumer_reps_; cr++)
+ {
+ consumer_reps_[cr] = new ACE_ES_Consumer_Rep;
+ if (consumer_reps_[cr] == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "ACE_ES_Consumer_Correlation::connected"), -1);
+ }
+ }
+
+ n_timer_reps_ = iter.n_timeouts ();
+ if (n_timer_reps_ > 0)
+ {
+ timer_reps_ = new ACE_ES_Consumer_Rep_Timeout[n_timer_reps_];
+ if (timer_reps_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "ACE_ES_Consumer_Correlation::connected"), -1);
+ }
+
+ // This allocates more than is needed.
+ pending_events_ = new Event_Set[n_consumer_reps_ + n_timer_reps_];
+ if (pending_events_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "ACE_ES_Consumer_Correlation::connected"), -1);
+
+ return 0;
+}
+
+// We don't need synchronization until after we've been connected and
+// subscribed to events.
+int
+ACE_ES_Consumer_Correlation::connected (ACE_Push_Consumer_Proxy *consumer,
+ ACE_ES_Correlation_Module *correlation_module)
+{
+ correlation_module_ = correlation_module;
+ consumer_ = consumer;
+
+ // for (CORBA_Types::ULong index=0; index < consumer->qos ().dependencies_.length (); index++)
+ // consumer->qos ().dependencies_[index].event_.dump ();
+
+ ACE_ES_Dependency_Iterator iter (consumer->qos ().dependencies);
+ iter.parse ();
+ if (this->allocate_correlation_resources (iter) == -1)
+ return -1;
+
+
+ // Check if client has specified event fowarding.
+ if (consumer->qos ().forward_event.type_ != ACE_ES_EVENT_ANY)
+ {
+ forwarding_rt_info_ = iter.first_rt_info ();
+
+ if (forwarding_rt_info_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "ACE_ES_Consumer_Correlation::connected: "
+ "could not get rt_info_ from event "
+ "forwarding consumer.\n"), -1);
+
+ if (this->initialize_event_forwarding () == -1)
+ return -1;
+ }
+
+ int cgroup_index = -1;
+ int dgroup_index = -1;
+ int crep_index = 0;
+ int trep_index = 0;
+ RtecEventComm::EventType group_type = 0;
+
+ while (iter.advance_dependency () == 0)
+ {
+ // Keep track of how many conjunction and disjunction groups are
+ // registered. Update the index pointers so that the helper
+ // functions can update the appropriate group objects.
+ switch ((*iter).event_.type_)
+ {
+ case ACE_ES_CONJUNCTION_DESIGNATOR:
+ cgroup_index++;
+ ACE_ASSERT (cgroup_index < n_conjunction_groups_);
+ group_type = ACE_ES_CONJUNCTION_DESIGNATOR;
+ continue;
+
+ case ACE_ES_DISJUNCTION_DESIGNATOR:
+ dgroup_index++;
+ ACE_ASSERT (dgroup_index < n_disjunction_groups_);
+ group_type = ACE_ES_DISJUNCTION_DESIGNATOR;
+ continue;
+
+ case ACE_ES_GLOBAL_DESIGNATOR:
+ group_type = ACE_ES_GLOBAL_DESIGNATOR;
+ continue;
+
+ // These Delegate to the appropriate registration method.
+#if 0
+ // @@ TODO rt_info_ is a handle_t now, does checking against
+ // 0 still make sense?
+ // Check for a null rt_info.
+ if ((*iter).rt_info_ == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "Found a ConsumerQOS::dependencies[].rt_info_ == 0.\n"));
+ continue;
+ }
+#endif /* 0 */
+
+ case ACE_ES_EVENT_TIMEOUT:
+ // For backwards compatibility.
+ case ACE_ES_EVENT_DEADLINE_TIMEOUT:
+ if (this->register_deadline_timeout (*iter,
+ group_type,
+ cgroup_index,
+ dgroup_index,
+ trep_index) == -1)
+ return -1;
+ break;
+
+ case ACE_ES_EVENT_INTERVAL_TIMEOUT:
+ if (this->register_interval_timeout (*iter,
+ group_type,
+ cgroup_index,
+ dgroup_index,
+ trep_index) == -1)
+ return -1;
+ break;
+
+ case ACE_ES_EVENT_ACT:
+ // Store the ACT in the current conjunction or disjunction
+ // group.
+ switch (group_type)
+ {
+ case ACE_ES_CONJUNCTION_DESIGNATOR:
+ conjunction_groups_[cgroup_index].set_act ((*iter).event_);
+ break;
+ case ACE_ES_DISJUNCTION_DESIGNATOR:
+ disjunction_groups_[cgroup_index].set_act ((*iter).event_);
+ break;
+ case ACE_ES_GLOBAL_DESIGNATOR:
+ default:
+ ACE_ERROR ((LM_ERROR, "Warning: ACTs not implemented for Global.\n"));
+ }
+ break;
+
+ default:
+ // Non-timer event subscription.
+ if (this->register_event (*iter,
+ group_type,
+ cgroup_index,
+ dgroup_index,
+ crep_index) == -1)
+ return -1;
+ break;
+ }
+ }
+
+ // We may not use all of the consumer reps if there are repeats:
+ // (A+B)|(B+C). Must update n_consumer_reps_ so we don't try to
+ // unsubscribe a blank rep during disconnect.
+ if (crep_index < n_consumer_reps_)
+ n_consumer_reps_ = crep_index;
+
+ return 0;
+}
+
+int
+ACE_ES_Consumer_Correlation::register_deadline_timeout (RtecEventChannelAdmin::Dependency &dependency,
+ RtecEventComm::EventType group_type,
+ int cgindex,
+ int dgindex,
+ int &trep_index)
+{
+ // new_timeout will be returned as an ACT. When executed, it will
+ // forward *iter.event_ to the consumer.
+ ACE_ES_Consumer_Rep_Timeout *new_timeout = &timer_reps_[trep_index++];
+ new_timeout->init (this, dependency);
+ new_timeout->correlation_type (ACE_ES_Consumer_Rep::DEADLINE_TIMEOUT);
+ // Deadline timers do not need type ids.
+
+ switch (group_type)
+ {
+ case ACE_ES_CONJUNCTION_DESIGNATOR:
+ // Reps keep pointers back to the groups that they're deadlines for.
+ new_timeout->add_disjunction_group (conjunction_groups_[cgindex]);
+ // Groups keep references to the deadline timers for rescheduling.
+ if (conjunction_groups_[cgindex].set_deadline_timeout (new_timeout) == -1)
+ return -1;
+ break;
+
+ case ACE_ES_DISJUNCTION_DESIGNATOR:
+ new_timeout->add_disjunction_group (disjunction_groups_[dgindex]);
+ if (disjunction_groups_[dgindex].set_deadline_timeout (new_timeout) == -1)
+ return -1;
+ break;
+
+ case ACE_ES_GLOBAL_DESIGNATOR:
+ ACE_ERROR_RETURN ((LM_ERROR, "No global deadline timeouts, yet!\n"), -1);
+ }
+
+ return 0;
+}
+
+int
+ACE_ES_Consumer_Correlation::register_interval_timeout (RtecEventChannelAdmin::Dependency &dependency,
+ RtecEventComm::EventType group_type,
+ int cgindex,
+ int /* dgindex */,
+ int &trep_index)
+{
+ // new_timeout will be returned as an ACT. When executed, it will
+ // forward *iter.event_ to the consumer.
+ ACE_ES_Consumer_Rep_Timeout *new_timeout = &timer_reps_[trep_index++];
+ new_timeout->init (this, dependency);
+ new_timeout->type_id (this->new_type_id ());
+
+ switch (group_type)
+ {
+ case ACE_ES_CONJUNCTION_DESIGNATOR:
+ // If it's a conjunction, then we need to perform correlations
+ // on the timeout.
+ new_timeout->correlation_type (ACE_ES_Consumer_Rep::CORRELATE);
+ conjunction_groups_[cgindex].add_type (new_timeout->type_id ());
+ break;
+
+ case ACE_ES_DISJUNCTION_DESIGNATOR:
+ case ACE_ES_GLOBAL_DESIGNATOR:
+ new_timeout->correlation_type (ACE_ES_Consumer_Rep::NO_CORRELATION);
+ break;
+ }
+
+ // Schedule the timeout.
+ if (correlation_module_->schedule_timeout (new_timeout) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+// Search <creps> for a rep matching <dependency>. If one is not
+// found, allocate one. All returned reps should have the appropriate
+// type_id set.
+ACE_ES_Consumer_Rep *
+ACE_ES_Consumer_Correlation::get_consumer_rep (RtecEventChannelAdmin::Dependency &dependency,
+ int &crep_index)
+{
+ ACE_ES_Consumer_Rep *rep = 0;
+
+ // Step through all existing consumer reps.
+ for (int x=0; x < crep_index; x++)
+ {
+ // If <dependency> matches any previously subscribed consumer
+ // reps, we'll reuse it.
+ if (consumer_reps_[x]->dependency ()->event_.type_ == dependency.event_.type_
+#if defined(ACE_ES_LACKS_ORB)
+ && consumer_reps_[x]->dependency ()->event_.source_ ==
+ dependency.event_.source_
+#endif /* ACE_ES_LACKS_ORB */
+)
+ {
+ rep = consumer_reps_[x];
+ break;
+ }
+ }
+
+ // Check if we didn't find it.
+ if (rep == 0)
+ {
+ if (crep_index >= n_consumer_reps_)
+ ACE_ERROR_RETURN ((LM_ERROR, "Too many event registrations.\n"), 0);
+ // Allocate a new rep and set its type id.
+ rep = consumer_reps_[crep_index];
+ crep_index++;
+ rep->init (this, dependency);
+ rep->type_id (this->new_type_id ());
+ }
+
+ return rep;
+}
+
+int
+ACE_ES_Consumer_Correlation::new_type_id (void)
+{
+ int type_id = type_id_index_;
+ if (++type_id_index_ >= ACE_ES_MAX_SUBSCRIPTIONS)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_MAX_SUBSCRIPTIONS exceeded.\n"),0);
+ else
+ return type_id;
+}
+
+int
+ACE_ES_Consumer_Correlation::register_event (RtecEventChannelAdmin::Dependency &dependency,
+ RtecEventComm::EventType group_type,
+ int cgindex,
+ int dgindex,
+ int &crep_index)
+{
+ // These are stored in the subscription module data structures.
+ ACE_ES_Consumer_Rep *consumer_rep = this->get_consumer_rep (dependency, crep_index);
+
+ if (consumer_rep == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Consumer_Correlation::register_event"), -1);
+
+ // If we're forwarding, then subscriptions should affect the
+ // forwarding rt_info, not the consumer's rt_info. Ok, this might
+ // be dangerous since the consumer rep can be shared between many
+ // correlation groups.
+ if (forwarding_rt_info_ != 0)
+ consumer_rep->dependency ()->rt_info = forwarding_rt_info_;
+
+ switch (group_type)
+ {
+ case ACE_ES_CONJUNCTION_DESIGNATOR:
+ // If it's a conjunction, then we need to perform correlations
+ // on the object. Otherwise, NO_CORRELATION is set by default.
+ consumer_rep->correlation_type (ACE_ES_Consumer_Rep::CORRELATE);
+ conjunction_groups_[cgindex].add_type (consumer_rep->type_id ());
+ break;
+
+ case ACE_ES_DISJUNCTION_DESIGNATOR:
+ consumer_rep->add_disjunction_group (disjunction_groups_[dgindex]);
+ break;
+
+ case ACE_ES_GLOBAL_DESIGNATOR:
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Consumer_Correlation::register_event: "
+ "ACE_ES_GLOBAL_DESIGNATOR not implemented.\n"));
+ break;
+ }
+
+ // Subscribe the consumer_rep to the suppliers.
+ if (correlation_module_->subscribe (consumer_rep) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+int
+ACE_ES_Consumer_Correlation::initialize_event_forwarding (void)
+{
+ ACE_TRY
+ {
+ // Get supplier admin object.
+ RtecEventChannelAdmin::SupplierAdmin_ptr sa =
+ correlation_module_->channel_->for_suppliers (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ // if (env.exception () != 0)
+ // ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Consumer_Correlation::initialize_event_forwarding"
+ // "for_suppliers failed.\n"), -1);
+
+ // Get push consumer proxy.
+ channel_ = sa->obtain_push_consumer (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ // if (env.exception () != 0)
+ // ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Consumer_Correlation::initialize_event_forwarding"
+ // "obtain_push_consumer failed.\n"), -1);
+
+ // Create the supplierQOS.
+ qos_.publications_.length (1);
+ qos_.publications_[0].event_.type_ = consumer_->qos ().forward_event.type_;
+ qos_.publications_[0].dependency_info_.rt_info = forwarding_rt_info_;
+ qos_.publications_[0].dependency_info_.number_of_calls = 1;
+
+ // Connect to the channel.
+ channel_->connect_push_supplier (this, qos_, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ // if (env.exception () != 0)
+ // ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Consumer_Correlation::initialize_event_forwarding"
+ // "connect_push_supplier failed.\n"), -1);
+
+ // We're connected to the channel.
+ connected_ = 1;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Consumer_Correlation::initialize_event_forwarding"
+ " failed.\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+int
+ACE_ES_Consumer_Correlation::disconnecting (void)
+{
+ // If we were forwarding events, disconnect as a supplier.
+ if (connected_)
+ {
+ CORBA::Environment env;
+ channel_->disconnect_push_consumer (env);
+ if (env.exception () != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Consumer_Correlation::disconnecting failed.\n"));
+ }
+
+ for (int x=0; x < n_timer_reps_; x++)
+ correlation_module_->cancel_timeout (&timer_reps_[x]);
+
+ for (int y=0; y < n_consumer_reps_; y++)
+ if (consumer_reps_[y] != 0)
+ consumer_reps_[y]->disconnect ();
+
+ return 0;
+}
+
+ACE_ES_Dispatch_Request *
+ACE_ES_Consumer_Correlation::push (ACE_ES_Consumer_Rep *cr,
+ ACE_ES_Event_Container *event)
+{
+ ACE_TIMEPROBE (" ACE_ES_Consumer_Correlation::push, enter");
+
+ // Check if this event needs any correlating, or if it should just
+ // be forwarded real fast-like.
+ switch (cr->correlation_type ())
+ {
+ case ACE_ES_Consumer_Rep::NO_CORRELATION:
+ // Calls reschedule on all disjunction groups it belongs to.
+ cr->reschedule_deadlines ();
+
+ if (forwarding_rt_info_ != 0)
+ {
+ this->push_forward_event ();
+ return 0;
+ }
+ else
+ {
+ ACE_TIMEPROBE (" ACE_ES_Consumer_Correlation::push, determine NO CORRELATION");
+ ACE_ES_Dispatch_Request *request =
+ new ACE_ES_Dispatch_Request (consumer_, event, cr->dependency ()->rt_info);
+ ACE_TIMEPROBE (" ACE_ES_Consumer_Correlation::push, NO_CORR: alloc");
+
+ if (request == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Consumer_Correlation::push"), 0);
+
+ return request;
+ }
+
+ case ACE_ES_Consumer_Rep::CORRELATE:
+ return this->correlate (cr, event);
+
+ case ACE_ES_Consumer_Rep::DEADLINE_TIMEOUT:
+ {
+ if (forwarding_rt_info_ != 0)
+ {
+ // This will clear any pending events for this group.
+ cr->top_group ()->add_events (0, pending_events_, pending_flags_);
+
+ // Send the forward event.
+ this->push_forward_event ();
+ return 0;
+ }
+ else
+ {
+ ACE_ES_Dispatch_Request *request =
+ new ACE_ES_Dispatch_Request (consumer_, cr->dependency ()->rt_info);
+
+ if (request == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Consumer_Correlation::push"), 0);
+
+ // Add the deadline timeout to the outbox.
+ request->event_set () += event;
+
+ // Add any pending events to the outbox.
+ cr->top_group ()->add_events (&(request->event_set ()),
+ pending_events_, pending_flags_);
+
+ return request;
+ }
+ }
+
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Consumer_Correlation::push:"
+ " unknown correlation type\n"), 0);
+ }
+}
+
+// @@ If we're just event forwarding, then no pending_events_ need to
+// be kept! I'll add this optimization later.
+ACE_ES_Dispatch_Request *
+ACE_ES_Consumer_Correlation::correlate (ACE_ES_Consumer_Rep *cr,
+ ACE_ES_Event_Container *event)
+{
+ // If the consumer has specified correlation criteria, then we must
+ // first acquire the mutex.
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Consumer_Correlation::push"), 0);
+
+ // Add the new event to the pending events.
+ pending_events_[cr->type_id ()] += event;
+
+ // Set the bit corresponding to the arrived event.
+ // This should be pending_flags_->event_arrived (index);
+ ACE_SET_BITS (pending_flags_, ACE_INT2BIT[cr->type_id ()]);
+
+ ACE_ES_Dispatch_Request *request = 0;
+ Event_Set *outbox = 0;
+ // Since add_events changes pending_flags_, we need to keep this
+ // for all iterations through the conjunction groups.
+ u_long freeze_pending_flags = pending_flags_;
+
+ // This is to flag forwarding.
+ int forward_event = 0;
+
+ for (int x=0; x < n_conjunction_groups_; x++)
+ {
+ if (conjunction_groups_[x].should_forward (freeze_pending_flags))
+ {
+ // If there is a deadline timer for this conjunction group,
+ // this will reschedule them.
+ conjunction_groups_[x].reschedule_deadline ();
+
+ if (forwarding_rt_info_ == 0)
+ {
+ // First time in, allocate the new dispatch request.
+ if (request == 0)
+ {
+ request =
+ new ACE_ES_Dispatch_Request (consumer_,
+ cr->dependency ()->rt_info);
+ if (request == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Consumer_Correlation::correlate"), 0);
+ outbox = &(request->event_set ());
+ }
+ }
+ else
+ forward_event = 1;
+
+ // Add each of the pending events for this correlation to
+ // the outgoing dispatch request. If outbox == 0, then
+ // this will just clear any pending events.
+ conjunction_groups_[x].add_events (outbox,
+ pending_events_,
+ pending_flags_);
+ }
+ }
+
+ if (forward_event)
+ {
+ this->push_forward_event ();
+ return 0;
+ }
+ else
+ return request;
+}
+
+
+void
+ACE_ES_Consumer_Correlation::push_forward_event (void)
+{
+ ACE_TRY
+ {
+ RtecEventComm::EventSet set;
+ set.length(1);
+ set[0] = consumer_->qos ().forward_event;
+ channel_->push (set, ACE_TRY_ENV);
+ }
+ ACE_CATCH (CORBA::BAD_OPERATION, bad_op)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ACE_ES_Consumer_Correlation::push_forward_event - "));
+ // @@ TODO handle exceptions.
+ // "BAD_OP %s: %d, %s\n",
+ // bad_op.id(),
+ // bad_op.minor(),
+ // bad_op.param()));
+ }
+ ACE_CATCH (CORBA::SystemException, sys_ex)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ACE_ES_Consumer_Correlation::push_forward_event - "));
+ // @@ TODO: How to check the exceptions?
+ // "SYS_EX %s: %d, %s\n",
+ // sys_ex.id(),
+ // sys_ex.minor(),
+ // sys_ex.param()));
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ACE_ES_Consumer_Correlation::push_forward_event - "
+ "unexpected exception\n"));
+ }
+ ACE_ENDTRY;
+}
+
+// ************************************************************
+
+ACE_ES_Consumer_Rep::~ACE_ES_Consumer_Rep (void)
+{
+}
+
+void
+ACE_ES_Consumer_Rep::execute (void)
+{
+ ACE_ERROR ((LM_ERROR, "Warning! ACE_ES_Consumer_Rep::execute called.\n"));
+}
+
+// ************************************************************
+
+void
+ACE_ES_Consumer_Rep_Timeout::execute (void)
+{
+ if (this->receiving_events ())
+ {
+ CORBA::Environment __env;
+ ACE_Time_Value tv = ACE_OS::gettimeofday ();
+ timeout_event_->time_ = tv.sec () * 10000000 + tv.usec () * 10;
+ correlation_->correlation_module_->push (this, timeout_event_, __env);
+ if (__env.exception () != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Consumer_Rep_Timeout::execute: unexpected exception.\n"));
+ }
+}
+
+// ************************************************************
+
+ACE_ES_Subscription_Module::ACE_ES_Subscription_Module (ACE_EventChannel *channel)
+ : channel_ (channel),
+ up_ (0),
+ down_ (0)
+{
+}
+
+void
+ACE_ES_Subscription_Module::open (ACE_ES_Correlation_Module *up,
+ ACE_ES_Supplier_Module *down)
+{
+ // Brilliant.
+ up_ = up;
+ down_ = down;
+}
+
+ACE_ES_Subscription_Module::~ACE_ES_Subscription_Module (void)
+{
+}
+
+// When a supplier connects, we step through each of its
+// publications. For each event type published, we allocate a set in
+// the suppliers type collection. Then we build a subscribers list
+// starting with any consumers having a type-based subscription in the
+// global type collection.
+void
+ACE_ES_Subscription_Module::connected (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &_env)
+{
+ RtecEventComm::EventSourceID sid = 0;
+ // We will record the source_id for later usage.
+ {
+ ACE_ES_WGUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_THROW (SYNC_ERROR);
+ // @@ TODO: Orbix parameters
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Subscription_Module::connected"));
+
+ if (all_suppliers_.insert (supplier) == -1)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Subscription_Module insert failed.\n"));
+
+ // For every type that this supplier generates, bind a new
+ // Type_Subscribers to the type in the supplier proxy's type
+ // collection.
+ RtecEventChannelAdmin::PublicationSet &publications = supplier->qos ().publications_;
+
+ sid = publications[0].event_.source_;
+ for (CORBA::ULong index=0; index < publications.length (); index++)
+ {
+ // Check to make sure an RT_Info was specified.
+#if 0
+ // @@ TODO: We should check if rt_info is a valid handle_t.
+ if (publications[index].dependency_info_.rt_info.value() == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "Found a SupplierQOS::dependency_info_.rt_info_ == 0\n"));
+ continue;
+ }
+#endif
+
+ RtecEventComm::EventType &event_type = publications[index].event_.type_;
+
+ // Check to make sure a type was specified.
+ if (event_type == ACE_ES_EVENT_ANY)
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Subscription_Module::connected: "
+ "source is publishing ACE_ES_EVENT_ANY.\n"));
+ continue;
+ }
+
+ // Make a new set for the proxy. Include the dependency
+ // info describing the RT_Method that generates this event.
+ // This object will hold all the consumers that subscribe to
+ // this publication.
+ ACE_ES_Subscription_Info::Type_Subscribers *new_subscribers =
+ new ACE_ES_Subscription_Info::Type_Subscribers (&(publications[index].dependency_info_));
+
+ if (new_subscribers == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_ES_Subscription_Module::connected"));
+ return;
+ }
+
+ // Check the global type collection for consumers that register
+ // before suppliers.
+ ACE_ES_Subscription_Info::Type_Subscribers *existing_subscribers;
+ if (type_subscribers_.find (event_type, existing_subscribers) == 0)
+ {
+ // Iterate through existing subscribers.
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator iter (existing_subscribers->consumers_);
+
+ for (ACE_ES_Consumer_Rep **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ // Each existing subscriber will get appended to the
+ // new subscribers list. Dependencies are updated.
+
+ // @@ TODO: Handle exceptions.
+ ACE_Scheduler_Factory::server()->add_dependency
+ ((*proxy)->dependency()->rt_info,
+ new_subscribers->dependency_info_->rt_info,
+ new_subscribers->dependency_info_->number_of_calls,
+ _env);
+ ACE_DEBUG ((LM_ERROR, "%p - add_dependency (%d,%d,%d)\n",
+ "ACE_ES_Priority_Timer::schedule_timer",
+ (*proxy)->dependency()->rt_info,
+ new_subscribers->dependency_info_->rt_info,
+ new_subscribers->dependency_info_->number_of_calls));
+ if (_env.exception () != 0)
+ return;
+ // @@ TODO use the ACE_TRY macros.
+
+ if (new_subscribers->consumers_.insert (*proxy) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%p: add_dependency/insert failed.\n",
+ "ACE_ES_Subscription_Module::connected"));
+ continue;
+ }
+ }
+ }
+
+ // Put the new subscribers for this event type in the supplier
+ // proxy's type map.
+ if (supplier->subscription_info ().type_subscribers_.
+ bind (event_type, new_subscribers) != 0)
+ {
+ // This may occur with a double bind, I think.
+ ACE_ERROR ((LM_ERROR, "%p can't initialize type.\n",
+ "ACE_ES_Subscription_Module::connected"));
+ delete new_subscribers;
+ continue;
+ }
+ }
+ } // release lock
+
+ // Reregister any consumers that tried to subscribe before this
+ // supplier connected.
+ // NOTE: We used to call back the supplier here (using
+ // supplier->source_id()), this is ineffective and leads to all kind
+ // of dead-locks (the supplier is blocked and waiting for us).
+ // We use the information on the publications to get the source_id.
+ this->reregister_consumers (sid);
+}
+
+// Step through each of the source_subscribers looking for consumers
+// that registered for <source> before <source> connected.
+void
+ACE_ES_Subscription_Module::reregister_consumers (RtecEventComm::EventSourceID source_id)
+{
+ ACE_ES_Subscription_Info::Subscriber_Set *subscribers = 0;
+ if (source_subscribers_.find (source_id, subscribers) == -1)
+ // Not found.
+ return;
+
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator iter (*subscribers);
+
+ // Try to reregister all consumers.
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ iter.next (consumer) != 0;
+ iter.advance ())
+ if (this->subscribe (*consumer) == -1)
+ ACE_ERROR ((LM_ERROR, "%p.\n" "ACE_ES_Subscription_Module::reregister_consumers"));
+}
+
+
+void
+ACE_ES_Subscription_Module::disconnecting (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &_env)
+{
+ ACE_ES_WGUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_THROW (SYNC_ERROR);
+ // @@ TODO: Orbix parameters
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Subscription_Module::disconnected"));
+
+ if (all_suppliers_.remove (supplier) == -1)
+ ACE_THROW (SUBSCRIPTION_ERROR);
+ // @@ TODO: Orbix parameters.
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Subscription_Module remove failed"));
+
+ // Remove all consumers from the supplier's source-based subscription lists.
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator source_iterator
+ (supplier->subscription_info ().source_subscribers_);
+
+ for (ACE_ES_Consumer_Rep **consumer;
+ source_iterator.next (consumer) != 0;
+ source_iterator.advance ())
+ (*consumer)->_release ();
+
+ // Get the subscriber list for each type.
+ ACE_ES_Subscription_Info::Subscriber_Map_Iterator type_map_iterator
+ (supplier->subscription_info ().type_subscribers_);
+
+ for (ACE_ES_Subscription_Info::Subscriber_Map_Entry *entry;
+ type_map_iterator.next (entry) != 0;
+ type_map_iterator.advance ())
+ {
+ // Remove all consumers from the supplier's source-based subscription lists.
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator type_iterator
+ (entry->int_id_->consumers_);
+
+ for (ACE_ES_Consumer_Rep **c;
+ type_iterator.next (c) != 0;
+ type_iterator.advance ())
+ (*c)->_release ();
+ }
+}
+
+int
+ACE_ES_Subscription_Module::subscribe_all (ACE_ES_Consumer_Rep *)
+{
+ ACE_ERROR_RETURN ((LM_ERROR, "Consumer tried to register for all"
+ "events! This is not implemented.\n"), -1);
+}
+
+int
+ACE_ES_Subscription_Module::subscribe_source (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source)
+{
+ // Step through all Supplier Proxies looking for a match to
+ // -supplier-. Add the -consumer- to the correct supplier proxy.
+ Supplier_Iterator iter (all_suppliers_);
+
+ int success = -1;
+
+ for (ACE_Push_Supplier_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ // Operator == checks if <proxy> is a proxy for <supplier>.
+ if ((**proxy) == source)
+ {
+ ACE_ES_WGUARD mon ((*proxy)->subscription_info ().lock_);
+
+ ACE_ES_Subscription_Info::Subscriber_Set &set =
+ (*proxy)->subscription_info ().source_subscribers_;
+
+ // Insert the consumer to the supplier's subscription set for
+ // the type.
+ int insert_result = set.insert (consumer);
+ switch (insert_result)
+ {
+ case -1:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "Subscription Module::subscribe_source"), -1);
+ case 0:
+ default:
+ {
+ // Increment the consumer rep's reference count.
+ consumer->_duplicate ();
+ // Success.
+ // Add each of the supplier's dependency infos to the
+ // consumer's dependency list.
+ ACE_ES_Subscription_Info::Subscriber_Map_Iterator iter2
+ ((*proxy)->subscription_info ().type_subscribers_);
+
+ // Delete all type collections.
+ for (ACE_ES_Subscription_Info::Subscriber_Map_Entry *temp = 0;
+ iter2.next (temp) != 0;
+ iter2.advance ())
+ {
+ ACE_TRY
+ {
+ ACE_Scheduler_Factory::server()->add_dependency
+ (consumer->dependency()->rt_info,
+ temp->int_id_->dependency_info_->rt_info,
+ temp->int_id_->dependency_info_->number_of_calls,
+ ACE_TRY_ENV);
+ ACE_DEBUG ((LM_ERROR,
+ "%p - add_dependency (%d,%d,%d)\n",
+ "ACE_ES_Priority_Timer::subscribe_source",
+ consumer->dependency()->rt_info,
+ temp->int_id_->dependency_info_->rt_info,
+ temp->int_id_->dependency_info_->number_of_calls));
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ }
+ }
+
+ case 1:
+ // Already there.
+ success = 0;
+ break;
+ }
+ }
+ }
+
+ // Add the consumer to the global source subscribers list.
+ if (success == -1)
+ return ACE_ES_Subscription_Info::insert_or_allocate (source_subscribers_,
+ consumer,
+ source);
+ else
+ return success;
+}
+
+// Step through all Supplier Proxies. For each proxy, if it generates
+// <type>, add <consumer> to its subscription info.
+int
+ACE_ES_Subscription_Module::subscribe_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type)
+{
+ // First insert <consumer> into the global type collection set
+ // corresponding to <type>. The type collection will only be used
+ // when suppliers register late.
+ if (ACE_ES_Subscription_Info::insert_or_allocate (type_subscribers_,
+ consumer, type) == -1)
+ return -1;
+
+ consumer->_duplicate ();
+
+ Supplier_Iterator iter (all_suppliers_);
+
+ for (ACE_Push_Supplier_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ ACE_ES_WGUARD mon ((*proxy)->subscription_info ().lock_);
+ // Insert the consumer to the supplier's subscription set for
+ // the type. If the supplier does not publish this type, the
+ // operation will fail. If this succeeds, dependency_info will
+ // be added to the consumer.
+ RtecScheduler::Dependency_Info *dependency_info;
+ if (ACE_ES_Subscription_Info::insert_or_fail
+ ((*proxy)->subscription_info ().type_subscribers_,
+ consumer, type, dependency_info) == 0)
+ {
+ consumer->_duplicate ();
+ // Success. Add the supplier dependency info to the
+ // consumer's dependency list.
+ // @@ TODO handle exceptions.
+ ACE_TRY
+ {
+ ACE_Scheduler_Factory::server()->add_dependency
+ (consumer->dependency ()->rt_info,
+ dependency_info->rt_info,
+ dependency_info->number_of_calls,
+ ACE_TRY_ENV);
+ ACE_DEBUG ((LM_ERROR, "%p - add_dependency (%d,%d,%d)\n",
+ "ACE_ES_Priority_Timer::schedule_timer - ",
+ consumer->dependency ()->rt_info,
+ dependency_info->rt_info,
+ dependency_info->number_of_calls));
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "Subscription_Module::subscribe_type:"
+ " add_dependency failed.\n"));
+ return -1;
+ }
+ ACE_ENDTRY;
+ }
+ }
+
+ return 0;
+}
+
+int
+ACE_ES_Subscription_Module::subscribe_source_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source,
+ RtecEventComm::EventType type)
+{
+ // Step through all Supplier Proxies looking for a match to
+ // <supplier>. Once we find one, find the correct set for the
+ // specified type. Add the <consumer> to that set.
+ Supplier_Iterator iter (all_suppliers_);
+
+ int success = -1;
+
+ for (ACE_Push_Supplier_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ ACE_ES_WGUARD mon ((*proxy)->subscription_info ().lock_);
+
+ if ((**proxy) == source)
+ {
+ // Insert the consumer to the supplier's subscription set for
+ // the type.
+ RtecScheduler::Dependency_Info *dependency_info;
+ int insert_result = ACE_ES_Subscription_Info::insert_or_fail
+ ((*proxy)->subscription_info().type_subscribers_,
+ consumer, type, dependency_info);
+
+ switch (insert_result)
+ {
+ case -1:
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "Subscription Module::subscribe_source_type"), -1);
+ case 0:
+ default:
+ {
+ // Success.
+ // Add the supplier to the consumer's dependency list.
+ // @@ TODO handle exceptions.
+ ACE_TRY
+ {
+ ACE_Scheduler_Factory::server()->add_dependency
+ (consumer->dependency ()->rt_info,
+ dependency_info->rt_info,
+ dependency_info->number_of_calls,
+ ACE_TRY_ENV);
+ ACE_DEBUG ((LM_ERROR, "%p - add_dependency (%d,%d,%d)\n",
+ "ACE_Subscription_Module::subscribe_source_type - ",
+ consumer->dependency ()->rt_info,
+ dependency_info->rt_info,
+ dependency_info->number_of_calls));
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "Subscription_Module::subscribe_source_type:"
+ " add_dependency failed.\n"),
+ -1);
+ }
+ ACE_ENDTRY;
+ consumer->_duplicate ();
+ }
+ /* FALLTHROUGH */
+ case 1:
+ success = 0;
+
+ // Already there.
+ break;
+ }
+
+ }
+ }
+
+ if (success == -1)
+ // If we failed to find a source, insert this consumer in the
+ // global source subscriber list.
+ {
+ if (ACE_ES_Subscription_Info::insert_or_allocate (source_subscribers_,
+ consumer,
+ source) == 0)
+ {
+ consumer->_duplicate ();
+ return 0;
+ }
+ else
+ return -1;
+ }
+ else
+ return success;
+}
+
+// <consumer> contains information for one type of subscription.
+// Delegate to the appropriate method for subscription.
+int
+ACE_ES_Subscription_Module::subscribe (ACE_ES_Consumer_Rep *consumer)
+{
+ // We could have finer granularity by putting RGUARDs in some of the
+ // subscribe methods.
+ ACE_ES_WGUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Subscription_Module::subscribe"), -1);
+
+ int result = 0;
+ RtecEventComm::Event &event = consumer->dependency ()->event_;
+
+ if (event.source_ == 0)
+ // Not source-based subscription.
+ {
+ if (event.type_ == ACE_ES_EVENT_ANY)
+ result = this->subscribe_all (consumer);
+ else
+ result = this->subscribe_type (consumer, event.type_);
+ }
+ else
+ // Source-based subscription.
+ {
+ if (event.type_ == ACE_ES_EVENT_ANY)
+ result = this->subscribe_source (consumer, event.source_);
+ else
+ result = this->subscribe_source_type (consumer, event.source_, event.type_);
+ }
+
+ return result;
+}
+
+int
+ACE_ES_Subscription_Module::unsubscribe (ACE_ES_Consumer_Rep *consumer)
+{
+ // We could have finer granularity by putting RGUARDs in some of the
+ // unsubscribe methods.
+ ACE_ES_WGUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Subscription_Module::unsubscribe"), -1);
+
+ RtecEventComm::Event &event = consumer->dependency ()->event_;
+
+ if (event.type_ != ACE_ES_EVENT_ANY)
+ {
+ // Remove the consumer from the global type-based subscription list.
+ if (ACE_ES_Subscription_Info::remove (type_subscribers_,
+ consumer, event.type_) == 0)
+ consumer->_release ();
+ }
+ else
+ // Remove the consumer from the global source-based subscription list.
+ if (ACE_ES_Subscription_Info::remove (source_subscribers_,
+ consumer, event.source_) == 0)
+ consumer->_release ();
+
+ return 0;
+
+ /*
+
+ This old code manually removed the consumer from the subscription
+ lists. Now we do lazy removal.
+
+ int result = 0;
+
+ if (CORBA::is_nil (event.source_))
+ {
+ if (event.type_ == ACE_ES_EVENT_ANY)
+ result = this->unsubscribe_all (consumer);
+ else
+ result = this->unsubscribe_type (consumer, event.type_);
+ }
+ else
+ {
+ if (event.type_ == ACE_ES_EVENT_ANY)
+ result = this->unsubscribe_source (consumer, event.source_);
+ else
+ result = this->unsubscribe_source_type (consumer, event.source_, event.type_);
+ }
+ return result;
+ */
+}
+
+int
+ACE_ES_Subscription_Module::unsubscribe_all (ACE_ES_Consumer_Rep *)
+{
+ return 0;
+}
+
+int
+ACE_ES_Subscription_Module::unsubscribe_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type)
+{
+ // Step through all Supplier Proxies trying to remove the
+ // consumer-type pair. ACE_ES_Subscription_Info::remove will fail
+ // if the supplier does not generate <type>, but that's ok.
+ Supplier_Iterator iter (all_suppliers_);
+
+ for (ACE_Push_Supplier_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ ACE_ES_WGUARD mon ((*proxy)->subscription_info ().lock_);
+
+ // This remove will be harmless if the supplier does not
+ // generate <type>.
+ ACE_ES_Subscription_Info::remove ((*proxy)->subscription_info ().type_subscribers_,
+ consumer, type);
+ }
+
+ return 0;
+}
+
+int
+ACE_ES_Subscription_Module::unsubscribe_source (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source)
+{
+ Supplier_Iterator iter (all_suppliers_);
+
+ for (ACE_Push_Supplier_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ ACE_ES_WGUARD mon ((*proxy)->subscription_info ().lock_);
+
+ if ((**proxy) == source)
+ {
+ ACE_ES_Subscription_Info::Subscriber_Set &set =
+ (*proxy)->subscription_info ().source_subscribers_;
+ if (set.remove (consumer) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "Subscription Module::unsubscribe_source"), -1);
+ }
+ }
+
+ return 0;
+}
+
+int
+ACE_ES_Subscription_Module::unsubscribe_source_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source,
+ RtecEventComm::EventType type)
+
+{
+ Supplier_Iterator iter (all_suppliers_);
+
+ // Step through all supplier proxies looking for a match to the
+ // consumer's event.source_. This is the same as unsubscribe_type,
+ // only we can check the source first.
+ for (ACE_Push_Supplier_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ // If the proxy matches the source id we're looking for, try to
+ // remove <consumer> from the proxy's <event.type_> set.
+ if ((**proxy) == source)
+ {
+ ACE_ES_WGUARD mon ((*proxy)->subscription_info ().lock_);
+
+ // Continue in spite of errors.
+ ACE_ES_Subscription_Info::remove ((*proxy)->subscription_info ().type_subscribers_,
+ consumer, type);
+ }
+
+ return 0;
+}
+
+void
+ACE_ES_Subscription_Module::push (ACE_Push_Supplier_Proxy *source,
+ ACE_ES_Event_Container *event,
+ CORBA::Environment &)
+{
+ ACE_TIMEPROBE ("deliver to Subscription Module");
+ // These are all inline function calls.
+ if (this->push_source (source, event) == -1)
+ return;
+
+ ACE_TIMEPROBE (" push_source_type");
+
+ if (this->push_source_type (source, event) == -1)
+ return;
+}
+
+void
+ACE_ES_Subscription_Module::shutdown (void)
+{
+ ACE_ES_WGUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR ((LM_ERROR, "%p.\n",
+ "ACE_ES_Subscription_Module::unsubscribe"));
+
+ // Remove all type_subscribers_ and source_subscribers_.
+
+ ACE_ES_Subscription_Info::Subscriber_Map_Iterator type_iter (type_subscribers_);
+ for (ACE_ES_Subscription_Info::Subscriber_Map_Entry *entry;
+ type_iter.next (entry) != 0;
+ type_iter.advance ())
+ {
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator ts_iter (entry->int_id_->consumers_);
+
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ ts_iter.next (consumer) != 0;
+ ts_iter.advance ())
+ (*consumer)->_release ();
+
+ delete entry->int_id_;
+ }
+
+ ACE_ES_Subscription_Info::SourceID_Map_Iterator source_iter (source_subscribers_);
+
+ for (ACE_ES_Subscription_Info::SourceID_Map_Entry *entry2;
+ source_iter.next (entry2) != 0;
+ source_iter.advance ())
+ {
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator ss_iter (*entry2->int_id_);
+
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ ss_iter.next (consumer) != 0;
+ ss_iter.advance ())
+ (*consumer)->_release ();
+
+ delete entry2->int_id_;
+ }
+
+ // We don't need to do anything to all_suppliers_ since the supplier
+ // module should have disconnected all suppliers. To be more
+ // independent from the supplier module, this method should iterate
+ // through all suppliers and call this->disconnecting.
+ up_->shutdown ();
+}
+
+// ************************************************************
+
+ACE_ES_Supplier_Module::ACE_ES_Supplier_Module (ACE_EventChannel *channel) :
+ all_suppliers_ (),
+ lock_ (),
+ me_ (this),
+ up_ (0),
+ channel_ (channel)
+{
+}
+
+void
+ACE_ES_Supplier_Module::open (ACE_ES_Subscription_Module *up)
+{
+ // There is the theory of the Mobius, a twist, in the fabric of
+ // space, where time becomes a loop, where time becomes a loop.
+ up_ = up;
+}
+
+void
+ACE_ES_Supplier_Module::connected (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &_env)
+{
+ channel_->report_connect (ACE_EventChannel::SUPPLIER);
+ up_->connected (supplier, _env);
+}
+
+void
+ACE_ES_Supplier_Module::disconnecting (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &_env)
+{
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ ACE_THROW (SYNC_ERROR);
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Supplier_Module::disconnected"));
+
+ if (all_suppliers_.remove (supplier) == -1)
+ ACE_THROW (SUBSCRIPTION_ERROR);
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Supplier_Module remove failed"));
+
+ up_->disconnecting (supplier, _env);
+
+ if (all_suppliers_.size () <= 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) No more suppliers connected.\n"));
+ channel_->report_disconnect (ACE_EventChannel::SUPPLIER);
+ }
+
+ CORBA::release (supplier);
+}
+
+void
+ACE_ES_Supplier_Module::shutdown (void)
+{
+ Suppliers copy;
+
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ return;
+
+ copy = all_suppliers_;
+ }
+
+ if (copy.size () > 0)
+ {
+ Supplier_Iterator iter (copy);
+
+ CORBA::Environment env;
+
+ for (ACE_Push_Supplier_Proxy **proxy = 0;
+ iter.next (proxy) != 0;
+ iter.advance ())
+ {
+ (*proxy)->shutdown ();
+ this->disconnecting (*proxy, env);
+ }
+ }
+
+ up_->shutdown ();
+}
+
+RtecEventChannelAdmin::ProxyPushConsumer_ptr
+ACE_ES_Supplier_Module::obtain_push_consumer (CORBA::Environment &_env)
+{
+ ACE_Push_Supplier_Proxy *new_supplier = new ACE_Push_Supplier_Proxy (this);
+
+ if (new_supplier == 0)
+ ACE_THROW_RETURN (CORBA::NO_MEMORY (CORBA::COMPLETED_NO), 0);
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO, "ACE_ES_Supplier_Module::obtain_push_consumer"));
+
+ {
+ ACE_ES_GUARD ace_mon (lock_);
+ if (ace_mon.locked () == 0)
+ {
+ delete new_supplier;
+ ACE_THROW_RETURN (SYNC_ERROR, 0);
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO,
+ // "ACE_ES_Supplier_Module::obtain_push_consumer"), 0);
+ }
+
+ if (all_suppliers_.insert (new_supplier) == -1)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Supplier_Module insert failed.\n"));
+ }
+
+ return new_supplier->get_ref ();
+}
+
+void
+ACE_ES_Supplier_Module::push (ACE_Push_Supplier_Proxy *proxy,
+ const RtecEventComm::EventSet &event,
+ CORBA::Environment &_env)
+{
+ ACE_TRY
+ {
+ for (int i = 0; i < event.length(); ++i)
+ {
+ ACE_ES_Event_Container *temp =
+ new ACE_ES_Event_Container (event[i]);
+ //RtecEventComm::Event *temp = new RtecEventComm::Event (event);
+
+ if (temp == 0)
+ ACE_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ // @@ TODO Orbix parameters:
+ // (0, CORBA::COMPLETED_NO,
+ // "ACE_ES_Supplier_Module::obtain_push_consumer"));
+
+ // This will guarantee that release gets called when we exit
+ // the scope.
+ ACE_ES_Event_Container_var event_copy (temp);
+ temp->_release ();
+ ACE_TIMEPROBE ("deliver to Supplier Module (thru Supplier Proxy)");
+ up_->push (proxy, event_copy, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ }
+ ACE_CATCH (RtecEventComm::Disconnected, d)
+ {
+ ACE_ERROR ((LM_ERROR, "%p Disconnected.\n",
+ "ACE_ES_Supplier_Module::push"));
+ ACE_RETHROW;
+ }
+ ACE_CATCH (RtecEventChannelAdmin::TypeError, t)
+ {
+ ACE_ERROR ((LM_ERROR, "%p Type Error.\n",
+ "ACE_ES_Supplier_Module::push"));
+ ACE_RETHROW;
+ }
+ ACE_CATCH (CORBA::NO_MEMORY, e)
+ {
+ ACE_ERROR ((LM_ERROR, "%p No Memory.\n",
+ "ACE_ES_Supplier_Module::push"));
+ ACE_RETHROW;
+ }
+ ACE_CATCH (CORBA::SystemException, e)
+ {
+ ACE_ERROR ((LM_ERROR, "%p CORBA System Exception.\n",
+ "ACE_ES_Supplier_Module::push"));
+ ACE_RETHROW;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Supplier_Module::push: "
+ "Unknown exception.\n"));
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+}
+
+// ************************************************************
+
+ACE_ES_Priority_Timer::ACE_ES_Priority_Timer (void)
+{
+}
+
+int
+ACE_ES_Priority_Timer::connected (RtecScheduler::handle_t rt_info)
+{
+ RtecScheduler::OS_Priority thread_priority;
+ RtecScheduler::Sub_Priority subpriority;
+ RtecScheduler::Preemption_Priority preemption_priority;
+
+ ACE_TRY
+ {
+ ACE_Scheduler_Factory::server ()->priority
+ (rt_info, thread_priority,
+ subpriority, preemption_priority, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+#if 0
+ ACE_ERROR_RETURN ((LM_ERROR, "%p RtecScheduler::Scheduler::priority failed.\n",
+ "ACE_ES_Priority_Timer::connected"), -1);
+#endif /* 0 */
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p RtecScheduler::Scheduler::priority failed.\n",
+ "ACE_ES_Priority_Timer::connected"), -1);
+ }
+ ACE_ENDTRY;
+
+ // Just make sure the ORB allocates resources for this priority.
+ if (ACE_Task_Manager::instance()->GetReactorTask (preemption_priority) == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p.\n",
+ "ACE_ES_Priority_Timer::connected"), -1);
+
+ return 0;
+}
+
+int
+ACE_ES_Priority_Timer::handle_timeout (const ACE_Time_Value &,
+ const void *vp)
+{
+ ACE_ES_Timer_ACT *act = (ACE_ES_Timer_ACT *) vp;
+
+ if (act == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Priority_Timer::handle_timeout: "
+ "received act == 0!!!.\n"), 0);
+
+ act->execute ();
+
+ return 0;
+}
+
+ACE_Timeprobe *ACE_Timeprobe::instance_ = 0;
+
+ACE_Timeprobe &
+ACE_Timeprobe::instance ()
+{
+ if (instance_ == 0)
+ {
+ // if this allocation fails, we're in big trouble . . .
+ ACE_NEW_RETURN (instance_, ACE_Timeprobe (), *instance_);
+ }
+
+ return *instance_;
+}
+
+void
+ACE_Timeprobe::timeprobe (const char *id)
+{
+ timeprobes [current_slot_].time_ = ACE_OS::gethrtime ();
+ timeprobes [current_slot_].id_ = id;
+
+ ++current_slot_;
+
+ ACE_ASSERT (current_slot_ < SLOTS);
+}
+
+void
+ACE_Timeprobe::print_times () const
+{
+ ACE_OS::printf ("\nACE_Timeprobe; %u timeprobes were recorded:\n",
+ current_slot_ > 1 ? current_slot_ - 1
+ : 0);
+
+ if (current_slot_ > 0)
+ {
+ for (u_int i = 1; i < current_slot_; ++i)
+ {
+ ACE_hrtime_t elapsed = timeprobes [i].time_ - timeprobes [i-1].time_;
+ ACE_OS::printf ("\"%-55s\"%10.3f usec\n",
+ timeprobes [i].id_,
+ (double) (elapsed / 1000) /* nanosec/microsec */);
+ }
+
+ ACE_hrtime_t elapsed2 = timeprobes [current_slot_ - 1].time_ -
+ timeprobes [0].time_;
+
+ // print the total time
+ ACE_OS::printf (
+ " =========\n"
+ " total"
+ "%10.3f usec\n",
+ (double) (elapsed2 / 1000) /* nanoseconds/microsecond */);
+ }
+}
+
+// ************************************************************
+
+const char *
+ACE_ES_Consumer_Name (const RtecEventChannelAdmin::ConsumerQOS &qos)
+{
+ // The first dependency should designate a correlation group.
+
+ ACE_TRY
+ {
+ RtecScheduler::RT_Info* rt_info = ACE_Scheduler_Factory::server ()->get
+ (qos.dependencies[1].rt_info, ACE_TRY_ENV);
+ ACE_TRY_ENV;
+
+ return rt_info->entry_point;
+ }
+ ACE_CATCHANY
+ {
+ return "no-name";
+ }
+ ACE_ENDTRY;
+ ACE_NOTREACHED (return "no-name");
+}
+
+// ************************************************************
+
+void
+dump_event (const RtecEventComm::Event &event)
+{
+ ACE_DEBUG ((LM_DEBUG, "source_ = %d "
+ "type_ = %d "
+ "time_ = %u.\n",
+ (void*)event.source_,
+ event.type_,
+ // The divide-by-1 is for ACE_U_LongLong support.
+ event.time_ / 1));
+}
+
+// ************************************************************
+
+#if defined(ACE_ES_LACKS_ORB)
+void
+dump_sequence (const ACE_CORBA_Sequence<ACE_ES_Event> &seq)
+{
+ for (CORBA::ULong index=0; index < seq.length (); index++)
+ ::dump_event (seq[index]);
+}
+#endif /* ACE_ES_LACKS_ORB */
+
+// ************************************************************
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+#if defined (ACE_ES_LACKS_ORB)
+//template class ACE_CORBA_Sequence<RtecEventComm::Event>;
+// template class ACE_CORBA_Sequence<RtecEventComm::Event_var>;
+template class ACE_CORBA_Sequence<RtecEventChannelAdmin::Dependency>;
+template class ACE_CORBA_Sequence<ACE_ES_Publication>;
+// For ACE_ES_Event_Container_var.
+template class ACE_CORBA_var<ACE_ES_Event_Container>;
+
+// Used in Event_Channel.cpp.
+template void operator+=(ACE_CORBA_Sequence<ACE_ES_Event> &,
+ ACE_ES_Event const &);
+#endif /* ACE_ES_LACKS_ORB */
+
+template class ACE_Map_Entry<ACE_ES_Subscription_Info::EXT, ACE_ES_Subscription_Info::INT>;
+template class ACE_Map_Entry<ACE_ES_Subscription_Info::sEXT, ACE_ES_Subscription_Info::sINT>;
+template class ACE_Map_Iterator<ACE_ES_Subscription_Info::EXT, ACE_ES_Subscription_Info::INT, ACE_ES_Subscription_Info::SYNCH>;
+template class ACE_Map_Iterator<ACE_ES_Subscription_Info::sEXT, ACE_ES_Subscription_Info::sINT, ACE_ES_Subscription_Info::SYNCH>;
+template class ACE_Map_Manager<ACE_ES_Subscription_Info::EXT, ACE_ES_Subscription_Info::INT, ACE_ES_Subscription_Info::SYNCH>;
+template class ACE_Map_Manager<ACE_ES_Subscription_Info::sEXT, ACE_ES_Subscription_Info::sINT, ACE_ES_Subscription_Info::SYNCH>;
+template class ACE_Node<ACE_ES_Consumer_Rep *>;
+template class ACE_Node<ACE_Push_Consumer_Proxy *>;
+template class ACE_Node<ACE_Push_Supplier_Proxy *>;
+template class ACE_Unbounded_Set<ACE_ES_Consumer_Rep *>;
+template class ACE_Unbounded_Set<ACE_Push_Consumer_Proxy *>;
+template class ACE_Unbounded_Set<ACE_Push_Supplier_Proxy *>;
+template class ACE_Unbounded_Set_Iterator<ACE_ES_Consumer_Rep *>;
+template class ACE_Unbounded_Set_Iterator<ACE_Push_Consumer_Proxy *>;
+template class ACE_Unbounded_Set_Iterator<ACE_Push_Supplier_Proxy *>;
+
+// For ACE_ES_Event_Container_Allocator.
+template class ACE_Cached_Allocator<ACE_ES_Event_Container_Chunk, ACE_Null_Mutex>;
+template class ACE_Cached_Allocator<ACE_ES_Dispatch_Request_Chunk, ACE_Null_Mutex>;
+template class ACE_Cached_Mem_Pool_Node<ACE_ES_Event_Container_Chunk>;
+template class ACE_Cached_Mem_Pool_Node<ACE_ES_Dispatch_Request_Chunk>;
+template class ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<ACE_ES_Event_Container_Chunk>, ACE_Null_Mutex>;
+template class ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<ACE_ES_Dispatch_Request_Chunk>, ACE_Null_Mutex>;
+template class ACE_Free_List<ACE_Cached_Mem_Pool_Node<ACE_ES_Event_Container_Chunk> >;
+template class ACE_Free_List<ACE_Cached_Mem_Pool_Node<ACE_ES_Dispatch_Request_Chunk> >;
+
+template class ACE_ES_Array_Iterator<ACE_ES_Consumer_Rep *>;
+template class ACE_ES_Simple_Array<ACE_ES_Consumer_Rep *, 100>;
+
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/local/bin/Event_Service/Event_Channel.h b/TAO/local/bin/Event_Service/Event_Channel.h
new file mode 100644
index 00000000000..3d536d10fa0
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Event_Channel.h
@@ -0,0 +1,1366 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ace ORB
+//
+// = FILENAME
+// Event_Channel
+//
+// = AUTHOR
+// Tim Harrison (harrison@cs.wustl.edu)
+//
+// = DESCRIPTION
+// ACE implementation of COSS Event Services For more detailed
+// information, see http://www.cs.wustl.edu/~mda/event.html.
+//
+// = NAMING CONVENTIONS
+// Some of the naming might be confusing. For instance
+// ACE_Push_Consumer_Proxy "is-a" ProxyPushSupplier. To the
+// channel, ACE_Push_Consumer_Proxy is a proxy to push consumers.
+// To a push consumer, ACE_Push_Consumer_Proxy is a proxy to push
+// suppliers. I chose to name classes relative to the Event
+// Channel.
+//
+// ============================================================================
+
+#ifndef ACE_EVENT_CHANNEL_H
+#define ACE_EVENT_CHANNEL_H
+
+#include "ace/Containers.h"
+#include "ace/Map_Manager.h"
+
+#include "Local_ESTypes.h"
+#include "CORBA_Utils_T.h"
+#include "Task_Manager.h"
+#include "ReactorTask.h"
+
+//ACE_INLINE void operator += (ACE_CORBA_Sequence<RtecEventComm::Event_var> &dest,
+// RtecEventComm::Event *item);
+
+ACE_INLINE int operator == (const RtecEventComm::Event &event1,
+ const RtecEventComm::Event &event2);
+// This operation could be part of the classes, but in order to stay
+// CORBA compliant, we're adding them as global operators.
+
+// ************************************************************
+
+class ACE_ES_Event_Container : public RtecEventComm_Event
+// = TITLE
+// Event Container
+//
+// = DESCRIPTION
+// Basically an ACE_ES_Event with reference counting and
+// thread-specific memory allocation.
+{
+public:
+ ACE_ES_Event_Container (void);
+ // Default construction.
+
+ ~ACE_ES_Event_Container (void);
+ // Destruction.
+
+ ACE_ES_Event_Container (const ACE_ES_Event_Container &);
+ // Copy construction.
+
+ ACE_ES_Event_Container (const RtecEventComm::Event &);
+ // Construction with an event.
+
+ ACE_ES_Event_Container *_duplicate (void);
+ // Increments ref_count_ and returns this.
+
+ void _release (void);
+ // Decrements ref_count_ and deletes if 0.
+
+ int operator== (const ACE_ES_Event_Container &event);
+ // Returns 1 if the two are "equal," 0 otherwise. Determines
+ // equality using source_ and type_ only. A 0 source_ is a wildcard
+ // (always equal). A type_ of ACE_ES_EVENT_ANY is also a wildcard.
+
+ void *operator new (size_t nbytes);
+ // Allocates memory from a thread-specific memory pool.
+
+ void operator delete (void *);
+ // Returns memory to a thread-specific memory pool.
+
+ void dump (void);
+
+private:
+ int ref_count_;
+};
+
+typedef ACE_CORBA_var<ACE_ES_Event_Container> ACE_ES_Event_Container_var;
+
+ACE_INLINE void operator += (ACE_CORBA_Sequence<ACE_ES_Event_Container_var> &dest,
+ ACE_ES_Event_Container *item);
+
+#if defined(ACE_ES_LACKS_ORB)
+// Utility for debugging sequences.
+ACE_Svc_Export void dump_sequence (const ACE_CORBA_Sequence<RtecEventComm::Event> &seq);
+#endif /* ACE_ES_LACKS_ORB */
+
+// Utility for debugging events.
+void dump_event (const RtecEventComm::Event &event);
+
+// ************************************************************
+
+class ACE_RTU_Manager
+// = TITLE
+// ACE RTU Manager
+//
+// = DESCRIPTION
+{
+public:
+ ACE_RTU_Manager (int active);
+ // If <active> == 0, everything returns 0. If <active> != 0, RTUs
+ // galore.
+
+ int should_preempt (void);
+ // Returns 1 if the current task should preempt itself. Otherwise,
+ // returns 0. Resets should_preempt to zero.
+
+ void should_preempt (int s);
+ // Called by the dispatching module when the current task should
+ // preempt itself.
+
+ void not_done (int nd);
+ // If <nd> != 0, the current running task will be enqueued at the
+ // head of its dispatch tail.
+
+ int not_done (void);
+ // Returns 1 if the current task needs to be dispatched again.
+ // Resets not_done_ to 0;
+
+ // = Get/set the priority of the current running task.
+ RtecScheduler::OS_Priority priority (void);
+ void priority (RtecScheduler::OS_Priority priority);
+
+private:
+ int active_;
+ int should_preempt_;
+ int not_done_;
+ RtecScheduler::OS_Priority priority_;
+};
+
+// ************************************************************
+
+// Chesire cat.
+class ACE_ES_Priority_Timer;
+// Forward declarations.
+class ACE_ES_Consumer_Module;
+class ACE_ES_Correlation_Module;
+class ACE_ES_Subscription_Module;
+class ACE_ES_Supplier_Module;
+// This forward decl and typedef allow us to remove inheritence later
+// on without changing any code.
+class ACE_ES_Dispatching_Base;
+typedef ACE_ES_Dispatching_Base ACE_ES_Dispatching_Module;
+
+// ec..
+class ACE_EventChannel : public RtecEventChannelAdmin_EventChannelBOAImpl
+// = TITLE
+// ACE Event Channel.
+//
+// = DESCRIPTION
+// Implementation of COSS Event Channel. For more detailed
+// information, see http://www.cs.wustl.edu/~mda/event.html.
+{
+public:
+ enum { INITIAL_STATE = 0,
+ CONSUMER = 1, SUPPLIER = 2,
+ SHUTDOWN = CONSUMER | SUPPLIER };
+
+ ACE_EventChannel (u_long type = ACE_DEFAULT_EVENT_CHANNEL_TYPE);
+ // Construction of the given <type>. Check the **_CHANNEL
+ // enumerations defined below.
+
+ virtual ~ACE_EventChannel (void);
+ // Calls destroy.
+
+ // = Accessor methods to Event Channel objects. The Event Channel
+ // acts as a sort of service repository of object references. All
+ // objects in the Event Service come to this interface to obtain
+ // object references during initialization.
+
+ virtual RtecEventChannelAdmin::ConsumerAdmin_ptr for_consumers (CORBA::Environment &);
+ // Consumer administration factory method.
+
+ virtual RtecEventChannelAdmin::SupplierAdmin_ptr for_suppliers (CORBA::Environment &);
+ // Supplier administration factory method.
+
+ virtual void destroy (CORBA::Environment &);
+ // Explicitly shut down the channel.
+
+ RtecEventChannelAdmin::EventChannel_ptr get_ref (void);
+ // Allow transformations to RtecEventChannelAdmin::EventChannel.
+
+ ACE_RTU_Manager *rtu_manager (void);
+ // Returns a reference to the RTU manager.
+
+ ACE_ES_Priority_Timer *timer (void);
+ // Timer accessor.
+
+ // = These should be private.
+ ACE_ES_Consumer_Module *consumer_module_;
+ ACE_ES_Dispatching_Module *dispatching_module_;
+ ACE_ES_Correlation_Module *correlation_module_;
+ ACE_ES_Subscription_Module *subscription_module_;
+ ACE_ES_Supplier_Module *supplier_module_;
+
+ ACE_ES_Priority_Timer *timer_;
+
+ void report_connect (u_long);
+ // Consumer or supplier connected.
+
+ void report_disconnect (u_long);
+ // Consumer or supplier disconnected.
+
+ void shutdown (void);
+ // Do not call this. The last module has shut down.
+
+private:
+ ACE_RTU_Manager *rtu_manager_;
+ // The RTU manager dude!
+
+ u_long type_;
+ // Can be any **_CHANNEL. (well, except NO_CHANNEL).
+
+ u_long state_;
+ // Can be INITIAL_STATE, NO_CONSUMERS, NO_SUPPLIERS, or SHUTDOWN.
+
+ ACE_ES_MUTEX lock_;
+ // Used to lock shared state.
+
+ RtecEventChannelAdmin::EventChannel_ptr me_;
+ // CORBA reference to self.
+
+ int destroyed_;
+ // Ensures this->destory is executed only once.
+};
+
+// ************************************************************
+
+class ACE_ES_Dependency_Iterator
+// = TITLE
+// ConsumerQOS Iterator
+//
+// = DESCRIPTION
+// This is used by the Event Channel to parse ConsumerDependency objects.
+{
+public:
+ ACE_ES_Dependency_Iterator (RtecEventChannelAdmin::DependencySet &rep);
+ // Construct and iterator for <rep>.
+
+ int advance_dependency (void);
+ // Returns 0 if the advance succeeded. Returns -1 if there are no
+ // more dependencies in the group.
+
+ int parse (void);
+ // Cache values for n_** methods.
+
+ int n_conjunctions (void);
+ // Returns the number of conjunction groups in the dependency set.
+
+ int n_disjunctions (void);
+ // Returns the number of disjunction groups in the dependency set.
+
+ int n_timeouts (void);
+ // Returns the number of timeouts registered.
+
+ int n_events (void);
+ // Returns the number of events registered.
+
+ RtecEventChannelAdmin::Dependency &operator *(void);
+ // Accessor to the current ConsumerDependency pointed to by the
+ // iterator.
+
+ RtecScheduler::handle_t first_rt_info (void);
+ // Returns the first RT_Info in the dependencies.
+
+protected:
+ RtecScheduler::handle_t rt_info_;
+ // The first rt_info in the dependencies.
+
+ RtecEventChannelAdmin::DependencySet &rep_;
+ // Reference to the dependency array.
+
+ int index_;
+ // Index into rep_.
+
+ RtecEventComm::EventType group_type_;
+ // The type of the current correlation group.
+
+ int n_conjunctions_;
+ // Number of conjunction groups.
+
+ int n_disjunctions_;
+ // Number of disjunction groups.
+
+ int n_timeouts_;
+ // Number of timeouts registered.
+
+ int n_events_;
+ // Number of events registered.
+};
+
+// ************************************************************
+
+class ACE_ES_Timer_ACT
+// = TITLE
+// Timer Asynchronous Completion Token
+//
+// = DESCRIPTION
+// Implements Command pattern with timers.
+{
+public:
+ virtual void execute (void) = 0;
+};
+
+// ************************************************************
+// Forward decl.
+class ACE_ES_Consumer_Rep_Timeout;
+
+class ACE_ES_Disjunction_Group
+// = TITLE
+// Disjunction Group
+//
+// = DESCRIPTION
+// Represents a disjunction group, such as (A|B|C).
+{
+public:
+ ACE_ES_Disjunction_Group (void);
+ // Default construction.
+
+ void set_correlation_module (ACE_ES_Correlation_Module *cm);
+ // <cm> is needed for rescheduling deadlines.
+
+ void reschedule_deadline (void);
+ // If deadline_timer_rep_ is set, it is cancelled and rescheduled.
+
+ int set_deadline_timeout (ACE_ES_Consumer_Rep_Timeout *cr);
+ // Set the group's reference to the deadline timer. Returns 0 on
+ // success, -1 on failure.
+
+ typedef ACE_CORBA_Sequence<ACE_ES_Event_Container_var> Event_Set;
+
+ virtual void add_events (Event_Set *outbox,
+ Event_Set *pending_events,
+ u_long &pending_flags);
+ // Does nothing. This is the only virtual method in this little
+ // heirarchy with the conjunction group.
+
+ void set_act (RtecEventComm::Event &act);
+ // Set the ACT for this group.
+
+protected:
+ ACE_ES_Event_Container_var act_;
+ // To be sent with this group.
+
+private:
+ ACE_ES_Consumer_Rep_Timeout *deadline_timer_rep_;
+ // The disjunction group keeps a reference to the deadline timer.
+
+ ACE_ES_Correlation_Module *correlation_module_;
+ // Used for cancelling and scheduling deadline_timer_rep_.
+};
+
+// ************************************************************
+
+class ACE_ES_Conjunction_Group : public ACE_ES_Disjunction_Group
+// = TITLE
+// Conjunction Group
+//
+// = DESCRIPTION
+// Represents a conjunction group, such as (A+B+C).
+{
+public:
+ ACE_ES_Conjunction_Group (void);
+ // Default construction.
+
+ int add_type (int type_id);
+ // Set the <type_id>th bit in the forward_value_.
+
+ int should_forward (u_long pending_flags);
+ // Returns 1 if this conjunction group's dependencies have been
+ // satisfied. Returns 0 otherwise.
+
+ typedef ACE_CORBA_Sequence<ACE_ES_Event_Container_var> Event_Set;
+
+ virtual void add_events (Event_Set *outbox,
+ Event_Set *pending_events,
+ u_long &pending_flags);
+ // For each bit set in forward_value_, the corresponding events in
+ // <pending_events> is added to <outbox>. Each bit set in
+ // <forward_value_> is cleared in <pending_flags>. If <oubox> == 0,
+ // then add_events just clears the pending events and flags.
+
+private:
+ u_long forward_value_;
+};
+
+// ************************************************************
+
+// Forward decl.
+class ACE_ES_Consumer_Correlation;
+
+class ACE_ES_Consumer_Rep : public ACE_ES_Timer_ACT
+// = TITLE
+// Consumer Representation.
+//
+// = DESCRIPTION
+// These are stored in the subscription module. They store
+// information that allows optimized correlations. It represents
+// the consumer that will handle *one* type of event. This
+// probably shouldn't inherit from ACE_ES_Timer_ACT since it's used
+// only by ACE_ES_Consumer_Rep_Timeout. However, this allows me to
+// minimize dynamic allocation.
+{
+public:
+ ACE_ES_Consumer_Rep (void);
+ // Default construction.
+
+ void init (ACE_ES_Consumer_Correlation *correlation,
+ RtecEventChannelAdmin::Dependency &dep);
+ // <dep> describes the event subscribed to and the method handling
+ // the event. <correlation> is the parent correlation object.
+
+ virtual ~ACE_ES_Consumer_Rep (void);
+ // Virtual destruction.
+
+ RtecEventChannelAdmin::Dependency *dependency (void);
+ // The event subscribed to and the method that will handle this
+ // event.
+
+ int type_id (void);
+ // Get the correlation group index of this consumer rep's event
+ // type.
+
+ void type_id (int);
+ // Set the correlation group index of this consumer rep's event
+ // type.
+
+ enum Correlation_Type
+ {
+ NO_CORRELATION,
+ CORRELATE,
+ DEADLINE_TIMEOUT,
+ GLOBAL_DEADLINE
+ };
+
+ u_long correlation_type (void);
+ // If this returns 0, then the event associated with this consumer
+ // should be forwarded without running any correlations.
+
+ void correlation_type (u_long ct);
+ // Set whether the event should be correlated. <ct> is a
+ // Correlation_Type.
+
+ int add_disjunction_group (ACE_ES_Disjunction_Group &);
+ // Add a disjunction group.
+
+ ACE_ES_Disjunction_Group *top_group (void);
+ // Returns the first disjunction group added via
+ // this->add_disjunction_group.
+
+ void reschedule_deadlines (void);
+ // Calls reschedule_deadline on all disjunction groups added through
+ // this->add_disjunction_group.
+
+ int receiving_events (void);
+ // Returns 1 if events should be sent to this consumer. Returns 0
+ // if they should not (suspended or disconnected).
+
+ void suspend (void);
+ // Stop forwarding events to the calling consumer.
+
+ void resume (void);
+ // Resume forwarding events to the calling consumer.
+
+ ACE_ES_Consumer_Correlation *correlation (void);
+ // Returns the Consumer_Correlation object for the target consumer.
+
+ void disconnect (void);
+ // Schedules the consumer rep to be removed from all subscription
+ // lists.
+
+ int disconnected (void);
+ // Returns 1 if the consumer rep should be removed from all
+ // subscription lists.
+
+ void _duplicate (void);
+ // Increments ref_count_.
+
+ void _release (void);
+ // Decrements ref_count_ and deletes this if 0.
+
+protected:
+ int disconnected_;
+ // Whether the rep should be removed from all subscription lists.
+
+ virtual void execute (void);
+ // This is called when timeouts occur. This implementation prints
+ // out an error message (since it really shouldn't be implemented in
+ // this class).
+
+ int suspended_;
+ // Whether events should be dropped or forwarded.
+
+ u_long correlation_type_;
+ // Whether any correlating should be done for this event.
+
+ RtecEventChannelAdmin::Dependency *dependency_;
+ // Event subscribed to.
+
+ ACE_ES_Consumer_Correlation *correlation_;
+ // The target consumer of events.
+
+ int type_id_;
+ // Correlation group index of event_->type_.
+
+ ACE_ES_Disjunction_Group *disjunction_group_;
+ // This should be a set. We'll just have room for one now.
+
+ ACE_Atomic_Op<ACE_ES_MUTEX, int> ref_count_;
+ // Lock for reference count.
+};
+
+class ACE_ES_Consumer_Rep_Timeout : public ACE_ES_Consumer_Rep
+// = TITLE
+// Consumer Representation.
+//
+// = DESCRIPTION
+// These are stored in the subscription module. They store
+// information that allows optimized correlations. It represents
+// the consumer that will handle *one* type of event.
+{
+public:
+ ACE_ES_Consumer_Rep_Timeout (void);
+ // Default construction.
+
+ void init (ACE_ES_Consumer_Correlation *correlation,
+ RtecEventChannelAdmin::Dependency &dep);
+ // <dep> describes the event subscribed to and the method handling
+ // the event. <correlation> is the parent correlation object.
+
+ // = Get/set timer returned from the reactor.
+ int timer_id (void);
+ void timer_id (int);
+
+ // = Get/set preemption priority.
+ RtecScheduler::OS_Priority preemption_priority (void);
+ void preemption_priority (RtecScheduler::OS_Priority pp);
+
+protected:
+ virtual void execute (void);
+ // This is called when timeouts occur. Calls correlation_->
+
+ int timer_id_;
+ // For cancelling timers.
+
+ RtecScheduler::OS_Priority preemption_priority_;
+ // Store the preemption priority so we can cancel the correct timer.
+ // The priority values may change during the life.
+
+ ACE_ES_Event_Container_var timeout_event_;
+};
+
+// ************************************************************
+
+class ACE_ES_Subscription_Info
+// = TITLE
+// Event Service Subscription Info
+//
+// = DESCRIPTION
+// Contains information on all consumers subscribed to a supplier.
+// Each Push_Supplier_Proxy has an instance of this class. This
+// should really be defined in Channel_Modules.h, but I want to
+// have an instance of it in each ACE_Push_Supplier_Proxy. This
+// allows us to reduce the amount of dynamic memory allocation.
+{
+public:
+ ~ACE_ES_Subscription_Info (void);
+ // Free up dynamic resources.
+
+ typedef ACE_Unbounded_Set_Iterator<ACE_ES_Consumer_Rep *> Subscriber_Set_Iterator;
+ typedef ACE_Unbounded_Set<ACE_ES_Consumer_Rep *> Subscriber_Set;
+
+ class Type_Subscribers
+ // = DESCRIPTION
+ // There is one of these for each event type generated by the
+ // supplier. It contains the subscribers and the
+ // dependency_info_ describing the method that generates this
+ // event type.
+ {
+ public:
+ Type_Subscribers (RtecScheduler::Dependency_Info *d)
+ : dependency_info_ (d) {}
+ // Construction requires a dependency info describing the method
+ // that generates events for the consumers_. We use a pointer so
+ // that a null can be passed in this->insert_or_allocate.
+
+ // void operator= (const Subscriber_Set &);
+ // Copy.
+
+ Subscriber_Set consumers_;
+ // All the consumers that have registered for this event.
+
+ RtecScheduler::Dependency_Info *dependency_info_;
+ // Description of the method that generates this event.
+ };
+
+ typedef RtecEventComm::EventType EXT;
+ typedef Type_Subscribers *INT;
+ typedef ACE_Null_Mutex SYNCH;
+ typedef ACE_Map_Manager<EXT, INT, SYNCH> Subscriber_Map;
+ typedef ACE_Map_Iterator<EXT, INT, SYNCH> Subscriber_Map_Iterator;
+ typedef ACE_Map_Entry<EXT, INT> Subscriber_Map_Entry;
+
+ Subscriber_Set source_subscribers_;
+ // Source-based subscribers.
+
+ Subscriber_Map type_subscribers_;
+ // Type-based subscribers.
+
+ // = These are just typedefs for source-based subscriptions.
+ typedef RtecEventComm::EventSourceID sEXT;
+ typedef Subscriber_Set *sINT;
+ typedef ACE_Map_Manager<sEXT, sINT, SYNCH> SourceID_Map;
+ typedef ACE_Map_Iterator<sEXT, sINT, SYNCH> SourceID_Map_Iterator;
+ typedef ACE_Map_Entry<sEXT, sINT> SourceID_Map_Entry;
+
+ ACE_ES_RW_LOCK lock_;
+ // Serializes writes to source_subscribers_ and type_subscribers_.
+
+ static int insert_or_allocate (SourceID_Map &source_subscribers,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID sid);
+ // <source_subscribers> contains a mapping of source id to consumer
+ // list. Insert <consumer> into the list of consumers subscribed to
+ // <sid>. Allocate a list for <sid> if necessary.
+
+ static int insert_or_allocate (Subscriber_Map &type_subscribers,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type);
+ // Add <consumer> to the set of consumers bound to <type> in
+ // <type_subscribers>. If there is consumer set for <type>, one is
+ // allocated. Returns -1 on failure, 0 otherwise.
+
+ static int insert_or_fail (Subscriber_Map &type_subscribers,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type,
+ RtecScheduler::Dependency_Info *&dependency);
+ // Add <consumer> to the set of consumers bound to <type> in
+ // <type_subscribers>. If there is consumer set for <type>, the
+ // operation fails. Returns -1 on failure, 0 otherwise.
+
+ static int remove (Subscriber_Map &type_map,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type);
+ // Remove <consumer> from the consumer set in <type_map> set
+ // corresponding to <type>.
+
+ static int remove (SourceID_Map &source_subscribers,
+ ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID sid);
+ // Remove <consumer> from the consumer set in the
+ // <source_subscribers> set corresponding to <sid>.
+
+ static void append_subscribers (Subscriber_Set &dest,
+ Subscriber_Set &src);
+ // Insert all elements of <src> into <dest>.
+};
+
+// ************************************************************
+
+// Forward declarations.
+class ACE_ES_Dispatch_Request;
+class ACE_Push_Consumer_Proxy;
+
+class ACE_ES_Consumer_Correlation : public RtecEventComm_PushSupplierBOAImpl
+// = TITLE
+// Event Service Consumer_Correlation
+//
+// = DESCRIPTION
+// There is one Consumer Correlation object per call to
+// connect_push_consumer. It handles all the consumer's
+// correlation dependencies including timeouts. This is also a
+// PushSupplier to support event forwarding.
+{
+public:
+ ACE_ES_Consumer_Correlation (void);
+ // Default construction.
+
+ virtual ~ACE_ES_Consumer_Correlation (void);
+ // Deletes lock_.
+
+ int connected (ACE_Push_Consumer_Proxy *consumer,
+ ACE_ES_Correlation_Module *correlation_module);
+ // Initialization. <correlation_module> is stored for delegating
+ // channel operations. <consumer> is stored to access the consumers
+ // qos and filterin data. Returns 0 on success, -1 on failure.
+
+ int disconnecting (void);
+ // Shutdown.
+
+ ACE_ES_Dispatch_Request *push (ACE_ES_Consumer_Rep *consumer,
+ ACE_ES_Event_Container *event);
+ // Takes <event> and adds it to the correlation. Returns the
+ // dispatch request that should be forwarded.
+
+ void suspend (void);
+ // Stop forwarding events to the calling consumer.
+
+ void resume (void);
+ // Resume forwarding events to the calling consumer.
+
+ ACE_ES_Correlation_Module *correlation_module_;
+ // Pointer back to the main correlation module. This is public so
+ // that ACE_ES_Consumer_Rep_Timeout::execute can access it.
+
+ typedef ACE_CORBA_Sequence<ACE_ES_Event_Container_var> Event_Set;
+
+private:
+ virtual void disconnect_push_supplier (CORBA::Environment &);
+ // Called when the channel disconnects us.
+
+ int allocate_correlation_resources (ACE_ES_Dependency_Iterator &iter);
+ // Dynamically allocates structures needed for correlations. 0 on
+ // success, -1 on failure.
+
+ ACE_ES_Dispatch_Request * correlate (ACE_ES_Consumer_Rep *cr,
+ ACE_ES_Event_Container *event);
+ // Helper function for this->push.
+
+ // = Registration helper functions.
+ int register_deadline_timeout (RtecEventChannelAdmin::Dependency &dependency,
+ RtecEventComm::EventType group_type,
+ int cgindex,
+ int dgindex,
+ int &trep_index);
+ int register_interval_timeout (RtecEventChannelAdmin::Dependency &dependency,
+ RtecEventComm::EventType group_type,
+ int cgindex,
+ int dgindex,
+ int &trep_index);
+ int register_event (RtecEventChannelAdmin::Dependency &dependency,
+ RtecEventComm::EventType group_type,
+ int cgindex,
+ int dgindex,
+ int &crep_index);
+
+ ACE_ES_Consumer_Rep *get_consumer_rep (RtecEventChannelAdmin::Dependency &dependency,
+ int &crep_index);
+ int new_type_id (void);
+
+ int type_id_index_;
+
+ RtecEventChannelAdmin::ProxyPushConsumer_ptr channel_;
+ // For event forwarding.
+
+ RtecScheduler::handle_t forwarding_rt_info_;
+ // Ties together the suppliers and the consumers of the forward
+ // event.
+
+ RtecEventChannelAdmin::SupplierQOS qos_;
+ // Supplier QOS specifications.
+
+ int initialize_event_forwarding (void);
+ // Becomes a supplier. Returns 0 on success, -1 on failure.
+
+ void push_forward_event (void);
+ // Pushes the forward event.
+
+ // Events waiting to be forwarded.
+ Event_Set *pending_events_;
+
+ // Used to synchronize pending_events_ and by the correlation module.
+ ACE_ES_MUTEX lock_;
+ // Used to lock shared state.
+
+ ACE_Push_Consumer_Proxy *consumer_;
+
+ u_long pending_flags_;
+ // A bit is set for each dependency satisfied.
+
+ ACE_ES_Consumer_Rep **consumer_reps_;
+ // Array of consumer rep pointers.
+ int n_consumer_reps_;
+ ACE_ES_Consumer_Rep_Timeout *timer_reps_;
+ int n_timer_reps_;
+
+ ACE_ES_Conjunction_Group *conjunction_groups_;
+ int n_conjunction_groups_;
+ ACE_ES_Disjunction_Group *disjunction_groups_;
+ int n_disjunction_groups_;
+
+ int connected_;
+ // True when we're connected to the channel for forwarding.
+};
+
+// ************************************************************
+
+class ACE_ES_ACT
+// = TITLE
+// Event Service ACT
+//
+// = DESCRIPTION
+//
+{
+public:
+ ACE_ES_ACT (void);
+ int has_act_;
+ RtecEventComm::Event act_;
+};
+
+// ************************************************************
+
+// Forward declarations.
+class ACE_ES_Dispatch_Request;
+
+class ACE_ES_Consumer_Module : public RtecEventChannelAdmin_ConsumerAdminBOAImpl
+// = TITLE
+// Event Service Consumer Module
+//
+// = DESCRIPTION
+// ProxyPushSupplier factory.
+{
+public:
+ ACE_ES_Consumer_Module (ACE_EventChannel *channel);
+ // Default construction.
+
+ void open (ACE_ES_Dispatching_Module *down);
+ // Link to the next module.
+
+ virtual RtecEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier (CORBA::Environment &);
+ // Factory method for push consumer proxies.
+
+ void connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &);
+ // Register the consumer with the Event Service. This handles all
+ // the details regarding Correlation_Module and Subscription_Module.
+
+ void disconnecting (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &);
+ // Unregister the consumer from the Event Service.
+
+ void push (const ACE_ES_Dispatch_Request *request,
+ CORBA::Environment &);
+
+ RtecEventChannelAdmin::ConsumerAdmin_ptr get_ref (void);
+ // Allow transformations to RtecEventChannelAdmin::ConsumerAdmin.
+
+ void shutdown_request (ACE_ES_Dispatch_Request *request);
+ // This is called by Shutdown_Consumer command objects when a
+ // consumer proxy is ready to be deleted.
+
+ void shutdown (void);
+ // Actively disconnect from all consumers.
+
+private:
+ typedef ACE_Unbounded_Set_Iterator<ACE_Push_Consumer_Proxy *> Consumer_Iterator;
+ typedef ACE_Unbounded_Set<ACE_Push_Consumer_Proxy *> Consumers;
+
+ ACE_ES_MUTEX lock_;
+ // Protects access to all_consumers_.
+
+ Consumers all_consumers_;
+
+ ACE_EventChannel *channel_;
+ // Used to test for shutdown.
+
+ RtecEventChannelAdmin::ConsumerAdmin_ptr me_;
+
+ ACE_ES_Dispatching_Module *down_;
+ // Next module down.
+};
+
+// ************************************************************
+
+// Forward declaration.
+class ACE_ES_Subscription_Module;
+
+class ACE_ES_Correlation_Module
+// = TITLE
+// Event Service Correlation Module
+//
+// = DESCRIPTION
+//
+{
+public:
+ ACE_ES_Correlation_Module (ACE_EventChannel *channel);
+ // Default construction.
+
+ void open (ACE_ES_Dispatching_Module *up,
+ ACE_ES_Subscription_Module *down);
+ // Link to adjacent modules.
+
+ void connected (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &);
+ // Create the consumers filter object.
+
+ void disconnecting (ACE_Push_Consumer_Proxy *consumer,
+ CORBA::Environment &);
+ // Release the consumers filter object.
+
+ void push (ACE_ES_Consumer_Rep *consumer,
+ ACE_ES_Event_Container *event,
+ CORBA::Environment &);
+ // Take in an event and its subscriber. Apply consumer-specific
+ // filters to each event and forward any dispatch requests to the
+ // Dispatching Module.
+
+ // = These are called by ACE_ES_Consumer_Reps.
+
+ int subscribe (ACE_ES_Consumer_Rep *consumer);
+ // Forwards to the subscription module.
+
+ //int unsubscribe (ACE_ES_Consumer_Rep *consumer);
+ // Forwards to the subscription module.
+
+ int schedule_timeout (ACE_ES_Consumer_Rep_Timeout *consumer);
+ // Schedule consumer timeout. Return 0 on success, -1 on failure.
+
+ int cancel_timeout (ACE_ES_Consumer_Rep_Timeout *consumer);
+ // Cancel consumer timeout. Return 0 on success, -1 on failure.
+
+ int reschedule_timeout (ACE_ES_Consumer_Rep_Timeout *consumer);
+ // Reschedule consumer timeout. Return 0 on success, -1 on failure.
+
+ ACE_EventChannel *channel_;
+ // The master channel. This is public so that Consumer_Correlation
+ // objects can access it.
+
+ void shutdown (void);
+ // Does nothing.
+
+private:
+ ACE_ES_Dispatching_Module *up_;
+ // Next module up.
+
+ ACE_ES_Subscription_Module *subscription_module_;
+ // Next module down.
+};
+
+// ************************************************************
+
+// Forward declaration.
+class ACE_ES_Supplier_Module;
+class ACE_Push_Supplier_Proxy;
+
+class ACE_ES_Subscription_Module
+// = TITLE
+// Event Service Subscription Module
+//
+// = DESCRIPTION
+//
+// = SYNCHRONIZATION
+// This is currently implemented with very coarse-grain
+// synchronization. Basically, there is a single readers/writer
+// lock. All operations acquire the writer lock to change any
+// subscription record. All operations acquire a reader lock to
+// read any subscription record. This is fine for normal
+// operations (which are *all* read operations). However, the
+// initialization and shutdown periods might benefit from the
+// potential increase in concurrency if we used finer grain locks
+// (e.g., lock-per-source).
+{
+public:
+ ACE_ES_Subscription_Module (ACE_EventChannel *channel);
+ // Default construction.
+
+ void open (ACE_ES_Correlation_Module *up,
+ ACE_ES_Supplier_Module *down);
+ // Link to the adjacent modules.
+
+ ~ACE_ES_Subscription_Module (void);
+ // Deletes the lock_.
+
+ int subscribe (ACE_ES_Consumer_Rep *consumer);
+ // Register a new consumer. Calls into <consumer> to figure out the
+ // subscription options. Returns 0 on success, -1 on failure.
+
+ int unsubscribe (ACE_ES_Consumer_Rep *consumer);
+ // Removes the -consumer- from any subscription lists.
+
+ void connected (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &);
+ void disconnecting (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &);
+
+ void push (ACE_Push_Supplier_Proxy *source,
+ ACE_ES_Event_Container *event,
+ CORBA::Environment &);
+ // Takes in a set of events and pushes subscriber sets to the
+ // Correlation Module.
+
+ // void push (ACE_Push_Supplier_Proxy *source,
+ // const RtecEventComm::Event event);
+ // This doesn't need one of these since it will never be called.
+
+ void shutdown (void);
+ // Unsubscribes all consumers from the suppliers.
+
+private:
+ void reregister_consumers (RtecEventComm::EventSourceID source_id);
+ // Reregister any consumers that registered for <source_id> before
+ // it actually connected to the channel.
+
+ ACE_EventChannel *channel_;
+ // The channel of all channels.
+
+ /*
+ typedef ACE_ES_Subscription_Info::Subscriber_Set INT;
+ typedef ACE_Null_Mutex SYNCH;
+ typedef ACE_Map_Manager<EXT, INT, SYNCH> Source_Collection;
+ typedef ACE_Map_Iterator<EXT, INT, SYNCH> Source_Collection_Iterator;
+ typedef ACE_Map_Entry<EXT, INT> Source_Collection_Entry;
+ Source_Collection source_subscription_info_;
+ // Source-only subscribers.
+ */
+
+ // = Subscribe helper methods. Returns 0 on success, -1 on failure.
+
+ int subscribe_all (ACE_ES_Consumer_Rep *consumer);
+
+ int subscribe_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type);
+
+ int subscribe_source (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source);
+
+ int subscribe_source_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source,
+ RtecEventComm::EventType type);
+
+ int unsubscribe_all (ACE_ES_Consumer_Rep *consumer);
+
+ int unsubscribe_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventType type);
+
+ int unsubscribe_source (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source);
+
+ int unsubscribe_source_type (ACE_ES_Consumer_Rep *consumer,
+ RtecEventComm::EventSourceID source,
+ RtecEventComm::EventType type);
+
+ // = Push helper methods.
+
+ int push_source (ACE_Push_Supplier_Proxy *source,
+ ACE_ES_Event_Container *event);
+ // Push <event> to all consumers subscribed to all events from
+ // <source>. Returns 0 on success, -1 on failure.
+
+ int push_source_type (ACE_Push_Supplier_Proxy *source,
+ ACE_ES_Event_Container *event);
+ // Push <event> to all consumers subscribed to <event>.type_ from
+ // <source>. Returns 0 on success, -1 on failure.
+
+ void push_all (ACE_ES_Event_Container *event,
+ CORBA::Environment &);
+ // Push <event> to all_suppliers_.
+
+ ACE_ES_Correlation_Module *up_;
+ // Next module up stream.
+
+ ACE_ES_Supplier_Module *down_;
+ // Next module down stream.
+
+ typedef ACE_Unbounded_Set_Iterator<ACE_Push_Supplier_Proxy *> Supplier_Iterator;
+ typedef ACE_Unbounded_Set<ACE_Push_Supplier_Proxy *> Suppliers;
+
+ Suppliers all_suppliers_;
+ // All suppliers.
+
+ ACE_ES_Subscription_Info::Subscriber_Map type_subscribers_;
+ // Type-based subscribers.
+
+ ACE_ES_Subscription_Info::SourceID_Map source_subscribers_;
+ // Source-based subscribers.
+
+ ACE_ES_RW_LOCK lock_;
+ // Protects access to all_suppliers_ and type_suppliers_;
+};
+
+// ************************************************************
+
+class ACE_ES_Supplier_Module : public RtecEventChannelAdmin_SupplierAdminBOAImpl
+// = TITLE
+// Event Service Supplier Proxy Module
+//
+// = DESCRIPTION
+// ProxyPushConsumer factory.
+{
+public:
+ ACE_ES_Supplier_Module (ACE_EventChannel *channel);
+ // Default construction.
+
+ void open (ACE_ES_Subscription_Module *up);
+ // Associate the module to a channel.
+
+ virtual RtecEventChannelAdmin::ProxyPushConsumer_ptr obtain_push_consumer (CORBA::Environment &);
+ // Factory method for push supplier proxies.
+
+ void push (ACE_Push_Supplier_Proxy *proxy,
+ const RtecEventComm::EventSet &event,
+ CORBA::Environment &);
+ // The supplier module acts on behalf of the supplier proxy to
+ // forward events through the channel.
+
+ void connected (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &);
+ // Register the consumer with the Event Service. This handles all
+ // the details regarding Correlation_Module and Subscription_Module.
+
+ void disconnecting (ACE_Push_Supplier_Proxy *supplier,
+ CORBA::Environment &);
+ // Unregister the consumer from the Event Service.
+
+ RtecEventChannelAdmin::SupplierAdmin_ptr get_ref (void);
+ // Allow transformations to RtecEventComm::PushConsumer.
+
+ void shutdown (void);
+ // Actively disconnect from all suppliers.
+
+private:
+ typedef ACE_Unbounded_Set_Iterator<ACE_Push_Supplier_Proxy *> Supplier_Iterator;
+ typedef ACE_Unbounded_Set<ACE_Push_Supplier_Proxy *> Suppliers;
+
+ Suppliers all_suppliers_;
+ // All suppliers.
+
+ ACE_ES_MUTEX lock_;
+ // Protects access to all_suppliers_ and type_suppliers_;
+
+ RtecEventChannelAdmin::SupplierAdmin_ptr me_;
+
+ ACE_ES_Subscription_Module *up_;
+
+ ACE_EventChannel *channel_;
+ // Used to test for shutdown.
+};
+
+// ************************************************************
+
+// Forward declarations.
+class ACE_EventChannel;
+
+// = Event Channel interfaces.
+
+class ACE_Push_Supplier_Proxy : public RtecEventChannelAdmin_ProxyPushConsumerBOAImpl
+// = TITLE
+// Push Supplier Proxy.
+//
+// = DESCRIPTION
+// To the channel, this is a proxy to suppliers. To suppliers, it
+// exports a PushConsumer interface. It is a
+// RtecEventChannelAdmin::ProxyPushConsumer. Suppliers use this
+// interface to connect to the channel, push events to consumers,
+// and to disconnect from the channel.
+{
+public:
+ ACE_Push_Supplier_Proxy (ACE_ES_Supplier_Module *supplier_module);
+ // Must be created with an owning supplier admin.
+
+ // = Operations public to suppliers.
+
+ virtual void connect_push_supplier (RtecEventComm::PushSupplier_ptr push_supplier,
+ const RtecEventChannelAdmin::SupplierQOS& qos,
+ CORBA::Environment &);
+ // Suppliers connect via this interface. <push_supplier> is a
+ // reference to the supplier. <qos> represents the publish types of
+ // the supplier.
+
+ virtual void push (const RtecEventComm::EventSet &event,
+ CORBA::Environment &);
+ // Data arriving from a PushSupplier that must be sent to
+ // consumers. This is the entry point of all events.
+
+ virtual void disconnect_push_consumer (CORBA::Environment &);
+ // Disconnect the supplier from the channel.
+
+ // = Operations for the Event Channel.
+
+ RtecEventChannelAdmin::ProxyPushConsumer_ptr get_ref (void);
+ // Allow transformations to RtecEventChannelAdmin::ProxyPushConsumer.
+
+ int connected (void);
+ // Returns 1 if the proxy has been connected to a "remote" client.
+
+ void shutdown (void);
+ // Actively disconnect from the supplier.
+
+ // This is a hook so that the Subscription Module can associate
+ // state with supplier proxies.
+ ACE_ES_Subscription_Info &subscription_info (void);
+
+ RtecEventChannelAdmin::SupplierQOS &qos (void);
+ // Filtering criteria.
+
+ int operator== (const RtecEventComm::EventSourceID rhs);
+ // Is this object a proxy for -rhs-. Simple pointer comparison for now.
+
+ RtecEventComm::EventSourceID source_id (void);
+ // Returns underlying supplier object ref.
+
+private:
+ RtecEventChannelAdmin::SupplierQOS qos_;
+ // Reference to the supplier's qos params.
+
+ ACE_ES_Subscription_Info subscription_info_;
+
+ ACE_ES_Supplier_Module *supplier_module_;
+
+ RtecEventComm::EventSourceID source_id_;
+ // We keep a proxy of the Supplier source_id_;
+
+ RtecEventChannelAdmin::ProxyPushConsumer_ptr me_;
+ // CORBA reference to self.
+
+ RtecEventComm::PushSupplier_ptr push_supplier_;
+ // CORBA reference to remote push supplier.
+};
+
+// ************************************************************
+
+class ACE_Push_Consumer_Proxy : public RtecEventChannelAdmin_ProxyPushSupplierBOAImpl
+// = TITLE
+// Push Consumer Proxy.
+//
+// = DESCRIPTION
+// This is the channels proxy to a push consumer. It implements
+// the RtecEventChannelAdmin::ProxyPushSupplier IDL interface.
+// Consumers use this interface to connect and disconnect from the
+// channel.
+{
+public:
+ ACE_Push_Consumer_Proxy (ACE_ES_Consumer_Module *cm);
+ // Must be created with an consumer admin.
+
+ virtual ~ACE_Push_Consumer_Proxy (void);
+ // Default destruction
+
+ // = Interfaces exported to consumers.
+
+ virtual void connect_push_consumer (RtecEventComm::PushConsumer_ptr push_consumer,
+ const RtecEventChannelAdmin::ConsumerQOS& qos,
+ CORBA::Environment &);
+ // A push consumer is connecting. <push_consumer> is a reference to
+ // the consumer. <qos> is the subscription types for the consumer.
+
+ virtual void disconnect_push_supplier (CORBA::Environment &);
+ // The consumer is disconnecting.
+
+ virtual void suspend (CORBA::Environment &);
+ // Stop forwarding events to the calling consumer.
+
+ virtual void resume (CORBA::Environment &);
+ // Resume forwarding events to the calling consumer.
+
+ // = Event Channel operations.
+
+ void push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &);
+ // Push <events> to push_consumer_.
+
+ int connected (void);
+ // Returns 1 if the proxy has been connected to a "remote" client.
+
+ void shutdown (void);
+ // Actively disconnect from the consumer.
+
+ RtecEventChannelAdmin::ProxyPushSupplier_ptr get_ref (void);
+ // Allow transformations to RtecEventChannelAdmin::ProxyPushSupplier.
+
+ ACE_ES_Consumer_Correlation &correlation (void);
+ // Access the consumer-specific Consumer_Correlation.
+
+ RtecEventChannelAdmin::ConsumerQOS &qos (void);
+ // Filtering criteria.
+
+private:
+ RtecEventChannelAdmin::ConsumerQOS qos_;
+ // A reference to the consumers Quality of Service parameters.
+
+ ACE_ES_Consumer_Correlation correlation_;
+ // A hook so that the Correlation Module can associate correlation
+ // information with the consumer.
+
+ RtecEventChannelAdmin::ProxyPushSupplier_ptr me_;
+ // CORBA reference to self.
+
+ RtecEventComm::PushConsumer_ptr push_consumer_;
+ // Reference to our push consumer.
+
+ ACE_ES_Consumer_Module *consumer_module_;
+ // TODO: Maybe this should be a _var or _duplicate/_release should
+ // be used
+};
+
+// ************************************************************
+
+// Helper function that returns
+// qos.dependencies_[0].rt_info_->entry_point or "no-name".
+const char *
+ACE_ES_Consumer_Name (const RtecEventChannelAdmin::ConsumerQOS &qos);
+
+class ACE_Timeprobe
+{
+public:
+ static ACE_Timeprobe &instance ();
+
+ void timeprobe (const char *id);
+
+ void print_times () const;
+
+ void reset();
+
+ void destroy ();
+
+private:
+ static ACE_Timeprobe *instance_;
+
+ enum { SLOTS = 1024 };
+
+ u_int current_slot_;
+
+ typedef struct timeprobe_info {
+ const char *id_;
+ ACE_hrtime_t time_;
+ } timeprobe_t;
+ timeprobe_t timeprobes [SLOTS];
+
+ ACE_Timeprobe ();
+ ~ACE_Timeprobe ();
+
+ friend class null_friend_to_avoid_compiler_warning_about_no_friends;
+
+ ACE_Timeprobe (const ACE_Timeprobe &); // not implemented
+};
+
+// ************************************************************
+
+typedef ACE_ES_Simple_Array <ACE_ES_Consumer_Rep *,
+ ACE_ES_MAX_CONSUMERS_PER_SUPPLIER> ACE_ES_CRSet;
+
+typedef ACE_ES_Array_Iterator <ACE_ES_Consumer_Rep *> ACE_ES_CRSet_Iterator;
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+# define ACE_TIMEPROBE_RESET ACE_Timeprobe::instance ().reset ()
+# define ACE_TIMEPROBE(id) ACE_Timeprobe::instance ().timeprobe (id)
+# define ACE_TIMEPROBE_PRINT ACE_Timeprobe::instance ().print_times ()
+# define ACE_TIMEPROBE_FINI ACE_Timeprobe::instance ().destroy ()
+#else
+# define ACE_TIMEPROBE_RESET
+# define ACE_TIMEPROBE(id)
+# define ACE_TIMEPROBE_PRINT
+# define ACE_TIMEPROBE_FINI
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+#if defined (__ACE_INLINE__)
+#include "Event_Channel.i"
+#endif /* __ACE_INLINE__ */
+#endif /* ACE_EVENT_CHANNEL_H */
+
diff --git a/TAO/local/bin/Event_Service/Event_Channel.i b/TAO/local/bin/Event_Service/Event_Channel.i
new file mode 100644
index 00000000000..c452ab1ce2a
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Event_Channel.i
@@ -0,0 +1,914 @@
+/* -*- C++ -*- */
+// $Id$
+
+const unsigned int ACE_INT2BIT[32] =
+{
+ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192,
+ 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152,
+ 4194304, 8388608, 16777216, 33554432, 67108864, 134217728,
+ 268435456, 536870912, 1073741824, 2147483648,
+};
+
+// **************************************************
+
+ACE_INLINE RtecEventChannelAdmin::ProxyPushConsumer_ptr
+ACE_Push_Supplier_Proxy::get_ref (void)
+{
+ return RtecEventChannelAdmin::ProxyPushConsumer::_duplicate(me_);
+}
+
+ACE_INLINE int
+ACE_Push_Supplier_Proxy::connected (void)
+{
+ return !CORBA::is_nil((CORBA::Object*) push_supplier_);
+}
+
+ACE_INLINE ACE_ES_Subscription_Info &
+ACE_Push_Supplier_Proxy::subscription_info (void)
+{
+ return subscription_info_;
+}
+
+ACE_INLINE RtecEventChannelAdmin::SupplierQOS &
+ACE_Push_Supplier_Proxy::qos (void)
+{
+ return qos_;
+}
+
+ACE_INLINE int
+ACE_Push_Supplier_Proxy::operator== (const RtecEventComm::EventSourceID rhs)
+{
+ // Pointer comparison is fine for now.
+ return (source_id_ == rhs);
+}
+
+ACE_INLINE RtecEventComm::EventSourceID
+ACE_Push_Supplier_Proxy::source_id (void)
+{
+ return source_id_;
+}
+
+// **************************************************
+
+ACE_INLINE RtecEventChannelAdmin::ProxyPushSupplier_ptr
+ACE_Push_Consumer_Proxy::get_ref (void)
+{
+ return RtecEventChannelAdmin::ProxyPushSupplier::_duplicate(me_);
+}
+
+ACE_INLINE RtecEventChannelAdmin::ConsumerQOS &
+ACE_Push_Consumer_Proxy::qos (void)
+{
+ return qos_;
+}
+
+ACE_INLINE int
+ACE_Push_Consumer_Proxy::connected (void)
+{
+ return !CORBA::is_nil(push_consumer_);
+}
+
+ACE_INLINE void
+ACE_Push_Consumer_Proxy::push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &_env)
+{
+ ACE_TIMEPROBE ("deliver event to consumer proxy");
+
+ if (push_consumer_ == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Push to disconnected consumer %s: ",
+ ::ACE_ES_Consumer_Name (this->qos ())));
+ // ACE_ES_DEBUG_ST (::dump_sequence (events));
+ return;
+ }
+
+ ACE_TRY
+ {
+ push_consumer_->push (events, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCH (RtecEventComm::Disconnected, d)
+ {
+ ACE_ERROR ((LM_ERROR, "consumer disconnected.\n"));
+ ACE_RETHROW;
+ }
+ ACE_CATCH (CORBA::SystemException, se)
+ {
+ ACE_ERROR ((LM_ERROR, "system exception.\n"));
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+}
+
+ACE_INLINE ACE_ES_Consumer_Correlation &
+ACE_Push_Consumer_Proxy::correlation (void)
+{
+ return correlation_;
+}
+
+ACE_INLINE RtecEventChannelAdmin::ConsumerAdmin_ptr
+ACE_ES_Consumer_Module::get_ref (void)
+{
+ return RtecEventChannelAdmin::ConsumerAdmin::_duplicate(me_);
+}
+
+ACE_INLINE RtecEventChannelAdmin::SupplierAdmin_ptr
+ACE_ES_Supplier_Module::get_ref (void)
+{
+ return RtecEventChannelAdmin::SupplierAdmin::_duplicate(me_);
+}
+
+// **************************************************
+
+ACE_INLINE RtecEventChannelAdmin::EventChannel_ptr
+ACE_EventChannel::get_ref (void)
+{
+ return RtecEventChannelAdmin::EventChannel::_duplicate(me_);
+}
+
+ACE_INLINE RtecEventChannelAdmin::SupplierAdmin_ptr
+ACE_EventChannel::for_suppliers (CORBA::Environment &)
+{
+ return supplier_module_->get_ref ();
+}
+
+ACE_INLINE RtecEventChannelAdmin::ConsumerAdmin_ptr
+ACE_EventChannel::for_consumers (CORBA::Environment &)
+{
+ return consumer_module_->get_ref ();
+}
+
+ACE_INLINE ACE_ES_Priority_Timer *
+ACE_EventChannel::timer (void)
+{
+ return timer_;
+}
+
+// ************************************************************
+
+// Makes a temporary Event_var and appends it to the <dest>.
+ACE_INLINE void
+operator += (ACE_CORBA_Sequence<ACE_ES_Event_Container_var> &dest,
+ ACE_ES_Event_Container *item)
+{
+ int length = dest.length ();
+ dest.length (length + 1);
+ dest[length] = item;
+}
+
+/*
+// Makes a temporary Event_var and appends it to the <dest>.
+ACE_INLINE void
+operator += (ACE_CORBA_Sequence<RtecEventComm::Event_var> &dest,
+ RtecEventComm::Event *item)
+{
+ // RtecEventComm::Event_var event (item);
+ int length = dest.length ();
+ dest.length (length + 1);
+ dest[length] = item;
+}
+*/
+
+ACE_INLINE int
+operator == (const RtecEventComm::Event &event1,
+ const RtecEventComm::Event &event2)
+{
+ // Check if the sources are equal. 0 is a wildcard.
+ if ((event1.source_ != 0) && (event2.source_ != 0)
+ && (event1.source_ != event2.source_))
+ return 0;
+
+ // Check if the types are equal. ACE_ES_EVENT_ANY is a wildcard.
+ if ((event1.type_ != ACE_ES_EVENT_ANY) &&
+ (event2.type_ != ACE_ES_EVENT_ANY) &&
+ (event1.type_ != event2.type_))
+ return 0;
+
+ return 1;
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_ES_ACT::ACE_ES_ACT (void)
+ : has_act_ (0)
+{
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_ES_Disjunction_Group::ACE_ES_Disjunction_Group (void) :
+ act_ (),
+ deadline_timer_rep_ (0),
+ correlation_module_ (0)
+{
+}
+
+ACE_INLINE void
+ACE_ES_Disjunction_Group::set_correlation_module (ACE_ES_Correlation_Module *cm)
+{
+ correlation_module_ = cm;
+}
+
+ACE_INLINE void
+ACE_ES_Disjunction_Group::reschedule_deadline (void)
+{
+ if (deadline_timer_rep_ != 0)
+ {
+ if (correlation_module_->reschedule_timeout (deadline_timer_rep_) == -1)
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_ES_Disjunction_Group::reschedule_deadline"));
+ }
+}
+
+ACE_INLINE int
+ACE_ES_Disjunction_Group::set_deadline_timeout (ACE_ES_Consumer_Rep_Timeout *cr)
+{
+ deadline_timer_rep_ = cr;
+ // Schedule the timeout.
+ if (correlation_module_->schedule_timeout (deadline_timer_rep_) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE void
+ACE_ES_Disjunction_Group::add_events (Event_Set *outbox,
+ Event_Set *pending_events,
+ u_long &pending_flags)
+{
+ ACE_UNUSED_ARG (pending_events);
+ ACE_UNUSED_ARG (pending_flags);
+
+ // Append the act.
+ if (act_ != 0)
+ *outbox += act_;
+}
+
+ACE_INLINE void
+ACE_ES_Disjunction_Group::set_act (RtecEventComm::Event &act)
+{
+ ACE_ES_Event_Container *temp = new ACE_ES_Event_Container (act);
+ if (temp == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_ES_Disjunction_Group::set_act"));
+ return;
+ }
+
+ act_ = temp;
+ temp->_release ();
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_ES_Consumer_Rep::ACE_ES_Consumer_Rep (void) :
+ disconnected_ (0),
+ suspended_ (0),
+ correlation_type_ (ACE_ES_Consumer_Rep::NO_CORRELATION),
+ dependency_ (0),
+ correlation_ (0),
+ type_id_ (0),
+ disjunction_group_ (0),
+ ref_count_ (1)
+{
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::init (ACE_ES_Consumer_Correlation *correlation,
+ RtecEventChannelAdmin::Dependency& dependency)
+{
+ dependency_ = &dependency;
+ correlation_ = correlation;
+}
+
+ACE_INLINE RtecEventChannelAdmin::Dependency*
+ACE_ES_Consumer_Rep::dependency (void)
+{
+ return dependency_;
+}
+
+ACE_INLINE int
+ACE_ES_Consumer_Rep::type_id (void)
+{
+ return type_id_;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::type_id (int id)
+{
+ type_id_ = id;
+}
+
+ACE_INLINE ACE_ES_Consumer_Correlation *
+ACE_ES_Consumer_Rep::correlation (void)
+{
+ return correlation_;
+}
+
+ACE_INLINE u_long
+ACE_ES_Consumer_Rep::correlation_type (void)
+{
+ return correlation_type_;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::correlation_type (u_long ct)
+{
+ correlation_type_ = ct;
+}
+
+ACE_INLINE int
+ACE_ES_Consumer_Rep::add_disjunction_group (ACE_ES_Disjunction_Group &dg)
+{
+ if (disjunction_group_ != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_ES_Consumer_Rep::add_disjunction_group: "
+ "disjunction_group already set!\n"));
+ disjunction_group_ = &dg;
+ return 0;
+}
+
+ACE_INLINE ACE_ES_Disjunction_Group *
+ACE_ES_Consumer_Rep::top_group (void)
+{
+ return disjunction_group_;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::reschedule_deadlines (void)
+{
+ if (disjunction_group_ != 0)
+ disjunction_group_->reschedule_deadline ();
+}
+
+ACE_INLINE int
+ACE_ES_Consumer_Rep::receiving_events (void)
+{
+ return suspended_ == 0 && disconnected_ == 0;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::suspend (void)
+{
+ suspended_ = 1;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::resume (void)
+{
+ suspended_ = 0;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::_duplicate (void)
+{
+ // This is atomic.
+ ref_count_++;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::_release (void)
+{
+ // This is atomic. rc is because we want to avoid Atomic_Op's
+ // operator==. Don't change this code unless you think you're more
+ // studly than ACE_Atomic_Op.
+ int rc = --ref_count_;
+
+ if (rc == 0)
+ delete this;
+}
+
+ACE_INLINE int
+ACE_ES_Consumer_Rep::disconnected (void)
+{
+ return disconnected_;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep::disconnect (void)
+{
+ disconnected_ = 1;
+}
+
+// ************************************************************
+
+// Forward <events> to all consumers subscribed to <source> only.
+ACE_INLINE int
+ACE_ES_Subscription_Module::push_source (ACE_Push_Supplier_Proxy *source,
+ ACE_ES_Event_Container *event)
+{
+ // If there are now source-based subscribers for this supplier,
+ // return.
+ if (source->subscription_info ().source_subscribers_.size () == 0)
+ return 0;
+
+ ACE_ES_Subscription_Info::Subscriber_Set &set =
+ source->subscription_info ().source_subscribers_;
+
+ // List of consumers that need to be disconnected.
+ ACE_ES_CRSet disconnect_list;
+
+ {
+ // Acquire a read lock.
+ ACE_ES_RGUARD ace_mon (source->subscription_info ().lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Subscription_Module::push_source.\n"), -1);
+
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator iter (set);
+
+ ACE_TRY
+ {
+ // Iterate through all subscribers.
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ iter.next (consumer) != 0;
+ iter.advance ())
+ {
+ // Only push the event if the consumer is not suspended
+ // and not disconnected.
+ if ((*consumer)->receiving_events ())
+ {
+ up_->push (*consumer, event, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ // If the consumer has disconnected, schedule it for
+ // disconnection. We can not modify our list now. It
+ // would mess up the iterator.
+ if ((*consumer)->disconnected ())
+ disconnect_list.insert (*consumer);
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ // Release the read lock.
+ }
+
+ // If there are consumers scheduled for disconnect, acquire a write
+ // lock and disconnect them.
+ if (disconnect_list.size () != 0)
+ {
+ ACE_ES_WGUARD ace_mon (source->subscription_info ().lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Subscription_Module::push_source.\n"), -1);
+
+ ACE_ES_CRSet_Iterator iter (disconnect_list.data (), disconnect_list.size ());
+
+ // Iterate through the disconnecting consumers.
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ iter.next (consumer) != 0;
+ iter.advance ())
+ {
+ // Remove the consumer from subscriber list.
+ if (set.remove (*consumer) == -1)
+ ACE_ERROR ((LM_ERROR, "%p remove failed.\n",
+ "ACE_ES_Subscription_Module::push_source.\n"));
+ else
+ // Decrement the consumer rep's reference count.
+ (*consumer)->_release ();
+ }
+ }
+
+ return 0;
+}
+
+// 1. figure out why we're going through the subscription module, instead of just passing through.
+// 2. where is lock_? Is there only one per module!?
+
+ACE_INLINE int
+ACE_ES_Subscription_Module::push_source_type (ACE_Push_Supplier_Proxy *source,
+ ACE_ES_Event_Container *event)
+{
+ // Step through each event in the set. For each event type, find
+ // the corresponding set in the type collection. Push the single
+ // event to each consumer in the set.
+
+ ACE_ES_Subscription_Info::Subscriber_Map &supplier_map =
+ source->subscription_info ().type_subscribers_;
+
+ ACE_ES_CRSet disconnect_list;
+
+ ACE_ES_Subscription_Info::Subscriber_Set *set;
+
+ {
+ ACE_ES_RGUARD ace_mon (source->subscription_info ().lock_);
+ if (ace_mon.locked () == 0)
+ {
+ ACE_TIMEPROBE (" push_source_type");
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Subscription_Module::push_source_type.\n"), -1);
+ }
+
+ ACE_ES_Subscription_Info::Type_Subscribers *subscribers;
+
+ if (supplier_map.current_size () == 0)
+ {
+ ACE_TIMEPROBE (" push_source_type");
+ return 0;
+ }
+
+ if (supplier_map.find (event->type_, subscribers) == -1)
+ {
+ ACE_DEBUG ((LM_ERROR, "ACE_ES_Subscription_Module::push_source_type"
+ " Warning: event type %d not registered.\n", event->type_));
+ ACE_TIMEPROBE (" push_source_type");
+ return 0; // continue anyway
+ }
+
+ if (subscribers->consumers_.size () == 0)
+ {
+ ACE_TIMEPROBE (" push_source_type");
+ return 0;
+ }
+
+ set = &subscribers->consumers_;
+
+ // We've found the set of consumers subscribed to this type
+ // of event from this supplier. Forward the event to each.
+ ACE_ES_Subscription_Info::Subscriber_Set_Iterator iter (*set);
+
+ ACE_TRY
+ {
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ iter.next (consumer) != 0;
+ iter.advance ())
+ {
+ if ((*consumer)->receiving_events ())
+ {
+ up_->push (*consumer, event, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ if ((*consumer)->disconnected ())
+ disconnect_list.insert (*consumer);
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_TIMEPROBE (" push_source_type");
+ return -1;
+ }
+ ACE_ENDTRY;
+ }
+
+ if (disconnect_list.size () != 0)
+ // Acquire a write lock and remove all disconnected consumers.
+ {
+ ACE_ES_WGUARD ace_mon (source->subscription_info ().lock_);
+ if (ace_mon.locked () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACE_ES_Subscription_Module::push_source.\n"), -1);
+
+ ACE_ES_CRSet_Iterator iter (disconnect_list.data (), disconnect_list.size ());
+
+ for (ACE_ES_Consumer_Rep **consumer = 0;
+ iter.next (consumer) != 0;
+ iter.advance ())
+ {
+ if (set->remove (*consumer) == -1)
+ ACE_ERROR ((LM_ERROR, "%p remove failed.\n",
+ "ACE_ES_Subscription_Module::push_source.\n"));
+ else
+ (*consumer)->_release ();
+ }
+ }
+
+ ACE_TIMEPROBE (" push_source_type");
+ return 0;
+}
+
+// ************************************************************
+
+ACE_INLINE ACE_RTU_Manager *
+ACE_EventChannel::rtu_manager (void)
+{
+ return rtu_manager_;
+}
+
+ACE_INLINE
+ACE_RTU_Manager::ACE_RTU_Manager (int active)
+ : active_ (active),
+ should_preempt_ (0),
+ not_done_ (0),
+ priority_ (ACE_Scheduler_MIN_PREEMPTION_PRIORITY)
+{
+}
+
+ACE_INLINE int
+ACE_RTU_Manager::should_preempt (void)
+{
+ if (!active_)
+ return 0;
+ else
+ {
+ // Expire any timers. Am I evil for putting this here?
+ ACE_Time_Value tv;
+ if (ACE_Task_Manager::instance ()->
+ GetReactorTask (0)->get_reactor ().handle_events (&tv) == -1)
+ ACE_ERROR ((LM_ERROR, "%p.\n",
+ "ACE_RTU_Manager::should_preempt"));
+
+ int should_preempt = should_preempt_;
+ should_preempt_ = 0;
+ return should_preempt;
+ }
+}
+
+ACE_INLINE void
+ACE_RTU_Manager::should_preempt (int s)
+{
+ should_preempt_ = s;
+}
+
+ACE_INLINE int
+ACE_RTU_Manager::not_done (void)
+{
+ int not_done = not_done_;
+ not_done_ = 0;
+ return not_done;
+}
+
+ACE_INLINE void
+ACE_RTU_Manager::not_done (int nd)
+{
+ not_done_ = nd;
+}
+
+ACE_INLINE RtecScheduler::OS_Priority
+ACE_RTU_Manager::priority (void)
+{
+ return priority_;
+}
+
+ACE_INLINE void
+ACE_RTU_Manager::priority (RtecScheduler::OS_Priority p)
+{
+ priority_ = p;
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_ES_Consumer_Rep_Timeout::ACE_ES_Consumer_Rep_Timeout (void) :
+ timer_id_ (0),
+ preemption_priority_ (ACE_Scheduler_MIN_PREEMPTION_PRIORITY),
+ timeout_event_ ()
+{
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep_Timeout::init (ACE_ES_Consumer_Correlation *correlation,
+ RtecEventChannelAdmin::Dependency &dep)
+{
+ ACE_ES_Event_Container *temp = new ACE_ES_Event_Container (dep.event_);
+ if (temp == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_ES_Consumer_Rep_Timeout::init"));
+ return;
+ }
+
+ timeout_event_ = temp;
+ temp->_release ();
+
+ ACE_ES_Consumer_Rep::init (correlation, dep);
+}
+
+ACE_INLINE int
+ACE_ES_Consumer_Rep_Timeout::timer_id (void)
+{
+ return timer_id_;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep_Timeout::timer_id (int id)
+{
+ timer_id_ = id;
+}
+
+ACE_INLINE RtecScheduler::OS_Priority
+ACE_ES_Consumer_Rep_Timeout::preemption_priority (void)
+{
+ return preemption_priority_;
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Rep_Timeout::preemption_priority (RtecScheduler::OS_Priority p)
+{
+ preemption_priority_ = p;
+}
+
+// ************************************************************
+
+ACE_INLINE void
+ACE_ES_Consumer_Correlation::suspend (void)
+{
+ for (int x=0; x < n_timer_reps_; x++)
+ timer_reps_[x].suspend ();
+
+ for (int y=0; y < n_consumer_reps_; y++)
+ consumer_reps_[y]->suspend ();
+}
+
+ACE_INLINE void
+ACE_ES_Consumer_Correlation::resume (void)
+{
+ for (int x=0; x < n_timer_reps_; x++)
+ timer_reps_[x].resume ();
+
+ for (int y=0; y < n_consumer_reps_; y++)
+ consumer_reps_[y]->resume ();
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_ES_Dependency_Iterator::ACE_ES_Dependency_Iterator (RtecEventChannelAdmin::DependencySet &rep) :
+ rt_info_ (0),
+ rep_ (rep),
+ index_ (-1),
+ n_conjunctions_ (0),
+ n_disjunctions_ (0),
+ n_timeouts_ (0),
+ n_events_ (0)
+{
+}
+
+ACE_INLINE int
+ACE_ES_Dependency_Iterator::advance_dependency (void)
+{
+ index_++;
+ if ((CORBA::ULong) index_ >= rep_.length ())
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE RtecEventChannelAdmin::Dependency &
+ACE_ES_Dependency_Iterator::operator *(void)
+{
+ return rep_[index_];
+}
+
+ACE_INLINE int
+ACE_ES_Dependency_Iterator::parse (void)
+{
+ for (CORBA::ULong x = 0; x < rep_.length (); x++)
+ {
+ if (rt_info_ == 0)
+ rt_info_ = rep_[x].rt_info;
+
+ switch (rep_[x].event_.type_)
+ {
+ case ACE_ES_CONJUNCTION_DESIGNATOR:
+ n_conjunctions_++;
+ break;
+
+ case ACE_ES_DISJUNCTION_DESIGNATOR:
+ n_disjunctions_++;
+ break;
+
+ case ACE_ES_EVENT_TIMEOUT:
+ case ACE_ES_EVENT_INTERVAL_TIMEOUT:
+ case ACE_ES_EVENT_DEADLINE_TIMEOUT:
+ n_timeouts_++;
+ break;
+
+ default:
+ n_events_++;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+ACE_INLINE int
+ACE_ES_Dependency_Iterator::n_conjunctions (void)
+{
+ return n_conjunctions_;
+}
+
+ACE_INLINE int
+ACE_ES_Dependency_Iterator::n_disjunctions (void)
+{
+ return n_disjunctions_;
+}
+
+ACE_INLINE int
+ACE_ES_Dependency_Iterator::n_timeouts (void)
+{
+ return n_timeouts_;
+}
+
+ACE_INLINE int
+ACE_ES_Dependency_Iterator::n_events (void)
+{
+ return n_events_;
+}
+
+ACE_INLINE RtecScheduler::handle_t
+ACE_ES_Dependency_Iterator::first_rt_info (void)
+{
+ return rt_info_;
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_Timeprobe::ACE_Timeprobe ()
+ : current_slot_ (0)
+{
+}
+
+ACE_INLINE
+ACE_Timeprobe::~ACE_Timeprobe ()
+{
+}
+
+ACE_INLINE void
+ACE_Timeprobe::destroy ()
+{
+ delete instance_;
+ instance_ = 0;
+}
+
+ACE_INLINE void
+ACE_Timeprobe::reset()
+{
+ current_slot_ = 0;
+}
+
+// ************************************************************
+
+ACE_INLINE
+ACE_ES_Conjunction_Group::ACE_ES_Conjunction_Group (void) :
+ forward_value_ (0)
+{
+}
+
+ACE_INLINE int
+ACE_ES_Conjunction_Group::add_type (int type_id)
+{
+ ACE_SET_BITS (forward_value_, ACE_INT2BIT[type_id]);
+ return 0;
+}
+
+/*
+ // Set length bits.
+ for (int x=0; x < length; x++)
+ {
+ forward_value_ <<= 1;
+ forward_value_ |= 1;
+ }
+ */
+
+ACE_INLINE int
+ACE_ES_Conjunction_Group::should_forward (u_long pending_flags)
+{
+ if ((forward_value_ & pending_flags) == forward_value_)
+ return 1;
+ else
+ return 0;
+}
+
+ACE_INLINE void
+ACE_ES_Conjunction_Group::add_events (Event_Set *outbox,
+ Event_Set *pending_events,
+ u_long &pending_flags)
+{
+ // Append the act first.
+ if (act_ != 0)
+ *outbox += act_;
+
+ u_long fv = forward_value_;
+ int x = 0;
+ while (fv > 0)
+ {
+ // If this type_id is part of the correlation, then append each
+ // event pending to the outbox.
+ if (ACE_BIT_ENABLED (forward_value_, ACE_INT2BIT[x]))
+ {
+ // Step through each of the pending events.
+ Event_Set &pending = pending_events[x];
+ for (CORBA::ULong y=0; y < pending.length (); y++)
+ {
+ // Add the pending event to the outbox.
+ if (outbox != 0)
+ *outbox += pending[y];
+ // Remove the event from the pending events array.
+ pending[y] = 0;
+ }
+
+ // Reset the array length.
+ pending.length (0);
+ // Since we just emptied the events for this type, clear the
+ // x^th bit in pending flags.
+ ACE_CLR_BITS (pending_flags, ACE_INT2BIT[x]);
+ // Clear the x^th bit in fv.
+ ACE_CLR_BITS (fv, ACE_INT2BIT[x]);
+ }
+
+ x++;
+ }
+}
+
+// ************************************************************
diff --git a/TAO/local/bin/Event_Service/Event_Service.cpp b/TAO/local/bin/Event_Service/Event_Service.cpp
new file mode 100644
index 00000000000..7ce9a0a91d1
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Event_Service.cpp
@@ -0,0 +1,82 @@
+//
+// $Id$
+//
+
+#include "ace/Get_Opt.h"
+#include "tao/corba.h"
+
+#include "CosNamingC.h"
+#include "Scheduler_Factory.h"
+#include "Event_Channel.h"
+#include "Event_Utilities.h"
+
+
+
+int main (int argc, char *argv[])
+{
+ ACE_TRY
+ {
+ // Initialize ORB.
+ CORBA::ORB_ptr orb =
+ CORBA::ORB_init (argc, argv, "internet", ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ CORBA::POA_ptr poa =
+ orb->POA_init(argc, argv, "POA");
+ if (poa == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+ }
+
+#if 0
+ CORBA::Object_ptr objref =
+ orb->resolve_initial_references ("NameService");
+ ACE_CHECK_ENV;
+
+ CosNaming::NamingContext_var naming_context =
+ CosNaming::NamingContext::_narrow (objref, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ ACE_DEBUG ((LM_DEBUG, "got reference to NameService\n"));
+
+ ACE_Scheduler_Factory::use_config (naming_context);
+#else
+ ACE_Scheduler_Factory::use_config (orb);
+#endif
+
+ // Register Event_Service with Naming Service.
+ ACE_EventChannel* ec;
+ ACE_NEW_RETURN (ec, ACE_EventChannel, -1);
+ CORBA::Object::_duplicate(ec);
+ ACE_CHECK_ENV;
+
+ CORBA::String str =
+ orb->object_to_string (ec, ACE_TRY_ENV);
+ ACE_OS::puts ((char *) str);
+
+#if 0
+ // @@ TODO: Should this be done automatically by the Event_Channel
+ // constructor?
+ CosNaming::Name channel_name (1);
+ channel_name[0].id = CORBA::string_dup ("EventService");
+ channel_name.length (1);
+ naming_context->bind (channel_name, ec, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+#endif
+
+ orb->run ();
+
+ CORBA::release (ec);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_TRY_ENV.print_exception ("EC");
+ }
+ ACE_ENDTRY;
+
+
+ return 0;
+}
diff --git a/TAO/local/bin/Event_Service/Fast_Reactor.h b/TAO/local/bin/Event_Service/Fast_Reactor.h
new file mode 100644
index 00000000000..d8af39b4f1d
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Fast_Reactor.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+#if !defined (FAST_REACTOR_H)
+#define FAST_REACTOR_H
+
+#if defined (ACE_OLD_STYLE_REACTOR)
+# if defined (ACE_WIN32)
+# include "ace/ReactorEx.h"
+# define ACE_ES_FAST_REACTOR_BASE ACE_ReactorEx
+# else
+# include "ace/Reactor.h"
+# define ACE_ES_FAST_REACTOR_BASE ACE_Reactor
+# endif /* ACE_WIN32 */
+#else
+# if defined (ACE_WIN32)
+# include "ace/WFMO_Reactor.h"
+# define ACE_ES_FAST_REACTOR_BASE ACE_WFMO_Reactor
+# else
+# include "ace/Select_Reactor.h"
+# define ACE_ES_FAST_REACTOR_BASE ACE_Select_Reactor
+# endif /* ACE_WIN32 */
+#endif /* ACE_OLD_STYLE_REACTOR */
+//## end module.includes
+
+class ACE_ES_Fast_Reactor : public ACE_ES_FAST_REACTOR_BASE
+{
+public:
+ virtual int handle_events (ACE_Time_Value *max_wait_time = 0)
+ {
+ ACE_Time_Value timer_buf (0) ;
+ ACE_Time_Value *this_timeout = &timer_buf ;
+
+ if (this->timer_queue_->calculate_timeout (max_wait_time,
+ this_timeout) == 0)
+ {
+ ACE_Time_Value t (0, 500000);
+ ACE_OS::select (0, 0, 0, 0, &t);
+ }
+ else
+ {
+ ACE_OS::select (0, 0, 0, 0, this_timeout);
+ }
+
+ return this->timer_queue_->expire () == -1 ? -1 : 0;
+ }
+};
+
+#endif /* FAST_REACTOR_H */
diff --git a/TAO/local/bin/Event_Service/GPlot_File.cpp b/TAO/local/bin/Event_Service/GPlot_File.cpp
new file mode 100644
index 00000000000..2f985e5d47c
--- /dev/null
+++ b/TAO/local/bin/Event_Service/GPlot_File.cpp
@@ -0,0 +1,171 @@
+// $Id$
+//
+// ============================================================================
+//
+// = FILENAME
+// GPlot_File.cpp
+//
+// = AUTHOR
+// Tim Harrison
+//
+// ============================================================================
+
+#include "GPlot_File.h"
+
+#if !defined (__ACE_INLINE__)
+#include "GPlot_File.i"
+#endif /* __ACE_INLINE__ */
+
+int
+ACE_GPlot_File::open (const char *filename)
+{
+ ACE_OS::strcpy (filename_, filename);
+
+ FILE *read_file = ACE_OS::fopen (filename_, "r");
+
+ long entry;
+ char *value;
+ ACE_NEW_RETURN (value, char [32], -1);
+
+ if (read_file > 0)
+ {
+ int result;
+ do
+ {
+ result = fscanf (read_file,
+ "%ld\t%s\n",
+ &entry,
+ value);
+
+ //if ((result == -1) && (ACE_OS::last_error () != 0))
+ //ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "ACE_GPlot_File::open"), -1);
+
+ if (result > 0)
+ // Success.
+ map_.bind (entry, value);
+ else if (result != EOF)
+ // Error.
+ {
+ ACE_OS::fclose (read_file);
+ ACE_ERROR_RETURN
+ ((LM_ERROR, "Error reading GPlot file %s.\n", filename_), -1);
+ }
+ } while (result != EOF);
+
+ fclose (read_file);
+ }
+
+ write_file_ = ACE_OS::fopen (filename_, "w");
+ if (write_file_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p: can't open\n", filename_), -1);
+
+ closed_ = 0;
+
+ return 0;
+}
+
+
+void
+ACE_GPlot_File::close (void)
+{
+ if (closed_ == 0)
+ {
+ closed_ = 1;
+ GPLOT_ITERATOR iterator ((GPLOT_MAP &) map_);
+ for (GPLOT_ENTRY *entry; iterator.next (entry); iterator.advance ())
+ {
+ ACE_OS::fprintf (write_file_, "%ld\t%s\n",
+ entry->ext_id_, entry->int_id_);
+ delete [] entry->int_id_;
+ }
+
+ ACE_OS::fclose (write_file_);
+ }
+}
+
+
+void
+ACE_GPlot_File::dump (void)
+{
+ GPLOT_ITERATOR iterator ((GPLOT_MAP &) map_);
+ for (GPLOT_ENTRY *entry; iterator.next (entry); iterator.advance ())
+ {
+ if (entry->int_id_ != 0)
+ ACE_DEBUG ((LM_DEBUG, "%d\t%s\n", entry->ext_id_, entry->int_id_));
+ else
+ {
+ ACE_ERROR ((LM_ERROR, "Value for entry %d is null.\n",
+ entry->ext_id_));
+ return;
+ }
+ }
+}
+
+
+int
+ACE_GPlot_File::get (long entry, long &value)
+{
+ char *val;
+
+ if (map_.find (entry, val) == -1)
+ return -1;
+ else
+ {
+ ::sscanf (val, "%ld", &value);
+ return 0;
+ }
+}
+
+
+int
+ACE_GPlot_File::get (long entry, float &value)
+{
+ char *val;
+
+ if (map_.find (entry, val) == -1)
+ return -1;
+ else
+ {
+ ::sscanf (val, "%f", &value);
+ return 0;
+ }
+}
+
+
+void
+ACE_GPlot_File::set (long entry, long value)
+{
+ long old_entry;
+ char *val;
+ char *old_value;
+
+ ACE_NEW (val, char [32]);
+
+ ::sprintf (val, "%ld", value);
+ map_.rebind (entry, val, old_entry, old_value);
+
+ delete [] old_value;
+}
+
+
+void
+ACE_GPlot_File::set (long entry, float value)
+{
+ long old_entry;
+ char *val;
+ char *old_value;
+
+ ACE_NEW (val, char [32]);
+
+ ::sprintf (val, "%f", value);
+ map_.rebind (entry, val, old_entry, old_value);
+
+ delete [] old_value;
+}
+
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Map_Entry<long, char *>;
+template class ACE_Map_Iterator<long, char *, ACE_Null_Mutex>;
+template class ACE_Map_Manager<long, char *, ACE_Null_Mutex>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/local/bin/Event_Service/GPlot_File.h b/TAO/local/bin/Event_Service/GPlot_File.h
new file mode 100644
index 00000000000..dc6040d0ed7
--- /dev/null
+++ b/TAO/local/bin/Event_Service/GPlot_File.h
@@ -0,0 +1,96 @@
+// $Id$
+//
+// ============================================================================
+//
+// = FILENAME
+// GPlot_File.h
+//
+// = AUTHOR
+// Tim Harrison
+//
+// ============================================================================
+
+#if !defined (ACE_GPlot_File_H)
+#define ACE_GPlot_File_H
+
+#include "ace/Map_Manager.h"
+#include "ace/Synch.h"
+
+class ACE_GPlot_File
+// = TITLE
+// Reads and writes files in GPlot format.
+//
+// = DESCRIPTION
+// Gplot formats are as follows:
+// entry value
+// entry value
+// entry value
+// ...
+// They represent x,y pairs to be graphed by GPlot. entry's are
+// type long. value's are type long or float.
+{
+public:
+ ACE_GPlot_File (void);
+ // Construction.
+
+ ~ACE_GPlot_File (void);
+ // Destruction. Calls this->close.
+
+ int open (const char *filename);
+ // If the file does not exist, create it. If the file exists open
+ // the file and read all the entries into map_. Returns 0 on
+ // success, -1 on failure.
+
+ void close (void);
+ // Close the file and sync all the contents.
+
+ int get (long entry, long &value);
+ // Get the entry at this value. Returns 0 if a value was found.
+ // Returns -1 if no value has been set for <entry>.
+
+ int get (long entry, float &value);
+ // Get the entry at this value. Returns 0 if a value was found.
+ // Returns -1 if no value has been set for <entry>.
+
+ void set (long entry, long value);
+ // Set the entry at this value.
+
+ void set (long entry, float value);
+ // Set the entry at this value.
+
+ void set_greatest (long entry, long value);
+ // Compare <value> with the value at <entry>. Store the largest.
+
+ void set_greatest (long entry, float value);
+ // Compare <value> with the value at <entry>. Store the largest.
+
+ void set_least (long entry, long value);
+ // Compare <value> with the value at <entry>. Store the smallest.
+
+ void set_least (long entry, float value);
+ // Compare <value> with the value at <entry>. Store the smallest.
+
+ void dump (void);
+ // Dump state of the object.
+
+private:
+ // = map_ stores all values. It is sync'ed to file when this->close
+ // is called.
+ typedef ACE_Map_Entry <long, char *> GPLOT_ENTRY;
+ typedef ACE_Map_Iterator <long, char *, ACE_Null_Mutex> GPLOT_ITERATOR;
+ typedef ACE_Map_Manager<long, char *, ACE_Null_Mutex> GPLOT_MAP;
+ GPLOT_MAP map_;
+
+ char filename_[BUFSIZ];
+ FILE *write_file_;
+
+ int closed_;
+ // Only close once.
+};
+
+#if defined (__ACE_INLINE__)
+#include "GPlot_File.i"
+#endif /* __ACE_INLINE__ */
+
+
+#endif /* ACE_GPlot_File_H */
diff --git a/TAO/local/bin/Event_Service/GPlot_File.i b/TAO/local/bin/Event_Service/GPlot_File.i
new file mode 100644
index 00000000000..ab9f235dc39
--- /dev/null
+++ b/TAO/local/bin/Event_Service/GPlot_File.i
@@ -0,0 +1,70 @@
+// $Id$
+
+ACE_INLINE
+ACE_GPlot_File::ACE_GPlot_File (void)
+ : closed_ (1)
+{
+}
+
+
+ACE_INLINE
+ACE_GPlot_File::~ACE_GPlot_File (void)
+{
+ this->close ();
+}
+
+
+ACE_INLINE
+void
+ACE_GPlot_File::set_greatest (long entry, long value)
+{
+ long old_value;
+
+ // If there was no previous value, or the <value> is greater than
+ // the previous value, set a new value.
+ if (this->get (entry, old_value) == -1 ||
+ value > old_value)
+ this->set (entry, value);
+}
+
+
+ACE_INLINE
+void
+ACE_GPlot_File::set_greatest (long entry, float value)
+{
+ float old_value;
+
+ // If there was no previous value, or the <value> is greater than
+ // the previous value, set a new value.
+ if (this->get (entry, old_value) == -1 ||
+ value > old_value)
+ this->set (entry, value);
+}
+
+
+ACE_INLINE
+void
+ACE_GPlot_File::set_least (long entry, long value)
+{
+ long old_value;
+
+ // If there was no previous value, or the <value> is less than
+ // the previous value, set a new value.
+ if (this->get (entry, old_value) == -1 ||
+ value < old_value)
+ this->set (entry, value);
+}
+
+
+ACE_INLINE
+void
+ACE_GPlot_File::set_least (long entry, float value)
+{
+ float old_value;
+
+ // If there was no previous value, or the <value> is less than
+ // the previous value, set a new value.
+ if (this->get (entry, old_value) == -1 ||
+ value < old_value)
+ this->set (entry, value);
+}
diff --git a/TAO/local/bin/Event_Service/Local_ESTypes.cpp b/TAO/local/bin/Event_Service/Local_ESTypes.cpp
new file mode 100644
index 00000000000..ebfd367dc9a
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Local_ESTypes.cpp
@@ -0,0 +1,9 @@
+//
+// $Id$
+//
+
+#include "Local_ESTypes.h"
+
+#if !defined (__ACE_INLINE__)
+#include "Local_ESTypes.i"
+#endif /* __ACE_INLINE__ */
diff --git a/TAO/local/bin/Event_Service/Local_ESTypes.h b/TAO/local/bin/Event_Service/Local_ESTypes.h
new file mode 100644
index 00000000000..3acea23d8d7
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Local_ESTypes.h
@@ -0,0 +1,62 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ORB Services
+//
+// = FILENAME
+// Local_ESTypes.h
+//
+// = AUTHOR
+// Tim Harrison (harrison@cs.wustl.edu)
+//
+// = DESCRIPTION
+// Manual types that would otherwise be defined/implemented via an
+// IDL compiler.
+// NOTE: the file is obsolecent, we have TAO now, but we keep it
+// to speed up the porting.
+//
+// ============================================================================
+
+#ifndef ACE_LOCAL_ESTYPES_H
+#define ACE_LOCAL_ESTYPES_H
+
+#include <tao/corba.h>
+
+#include "Event_Service_Constants.h"
+
+#include "CosNamingC.h"
+#include "RtecSchedulerC.h"
+#include "RtecSchedulerS.h"
+#include "RtecEventCommC.h"
+#include "RtecEventCommS.h"
+#include "RtecEventChannelAdminC.h"
+#include "RtecEventChannelAdminS.h"
+
+#define ACE_DEFAULT_EVENT_CHANNEL_TYPE 0
+
+// These are to help MSVC++ 4.2 deal with inheritence of nested types.
+// Not needed for Sun C++ or MSVC++ 5.0.
+
+// @@ NOTE: TAO uses the POA mapping instead of the old BOA, but all the
+// code still uses the BOA name for the skeleton classes, to speed up
+// porting we keep to old names.
+
+typedef RtecEventComm::Event RtecEventComm_Event;
+typedef POA_RtecScheduler::Scheduler RtecScheduler_SchedulerBOAImpl;
+typedef POA_RtecEventChannelAdmin::EventChannel RtecEventChannelAdmin_EventChannelBOAImpl;
+typedef POA_RtecEventComm::PushSupplier RtecEventComm_PushSupplierBOAImpl;
+typedef POA_RtecEventChannelAdmin::ConsumerAdmin RtecEventChannelAdmin_ConsumerAdminBOAImpl;
+typedef POA_RtecEventChannelAdmin::SupplierAdmin RtecEventChannelAdmin_SupplierAdminBOAImpl;
+typedef POA_RtecEventChannelAdmin::ProxyPushConsumer RtecEventChannelAdmin_ProxyPushConsumerBOAImpl;
+typedef POA_RtecEventChannelAdmin::ProxyPushSupplier RtecEventChannelAdmin_ProxyPushSupplierBOAImpl;
+typedef POA_RtecEventComm::PushConsumer RtecEventComm_PushConsumerBOAImpl;
+typedef POA_RtecEventComm::PushSupplier RtecEventComm_PushSupplierBOAImpl;
+
+#if defined (__ACE_INLINE__)
+#include "Local_ESTypes.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* ACE_LOCAL_ESTYPES_H */
diff --git a/TAO/local/bin/Event_Service/Local_ESTypes.i b/TAO/local/bin/Event_Service/Local_ESTypes.i
new file mode 100644
index 00000000000..8f8ef4cfe2d
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Local_ESTypes.i
@@ -0,0 +1,5 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
diff --git a/TAO/local/bin/Event_Service/Makefile b/TAO/local/bin/Event_Service/Makefile
new file mode 100644
index 00000000000..e91f278121a
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Makefile
@@ -0,0 +1,1226 @@
+#
+# $Id$
+#
+
+BIN = Event_Service
+BUILD = $(BIN)
+
+LSRC = \
+ Event_Service.cpp \
+ BCU.cpp \
+ CORBA_Utils_T.cpp \
+ Dispatching_Modules.cpp \
+ Event_Channel.cpp \
+ GPlot_File.cpp \
+ Local_ESTypes.cpp \
+ Memory_Pools.cpp \
+ RT_Task.cpp \
+ ReactorTask.cpp \
+ Task_Manager.cpp \
+
+ES_OBJS=$(LSRC:.cpp=.o)
+
+LDLIBS = -lorbsvcs -lTAO
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+ifndef TAO_ROOT
+TAO_ROOT = $(ACE_ROOT)/TAO
+endif
+TSS_ORB_FLAG = #-DTAO_HAS_TSS_ORBCORE
+DCFLAGS = -g
+LDFLAGS += -L$(TAO_ROOT)/orbsvcs/lib -L$(TAO_ROOT)/tao
+CPPFLAGS += -I$(TAO_ROOT)/orbsvcs/lib -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat $(TSS_ORB_FLAG)#-H
+
+Event_Service: $(addprefix $(VDIR),$(ES_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/Event_Service.o .shobj/Event_Service.: Event_Service.cpp \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/managed_types.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/managed_types.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.i \
+ Event_Channel.h Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i CORBA_Utils_T.h CORBA_Utils_T.i Task_Manager.h \
+ RT_Task.h RT_Task.i Task_Manager.i ReactorTask.h Fast_Reactor.h \
+ $(ACE_ROOT)/ace/Select_Reactor.h \
+ $(ACE_ROOT)/ace/Token.h \
+ $(ACE_ROOT)/ace/Token.i \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(ACE_ROOT)/ace/Select_Reactor.i \
+ $(ACE_ROOT)/ace/Timer_Heap.h \
+ $(ACE_ROOT)/ace/Timer_Heap_T.h \
+ $(ACE_ROOT)/ace/Timer_List.h \
+ $(ACE_ROOT)/ace/Timer_List_T.h \
+ Event_Channel.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Utilities.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Utilities.i
+.obj/BCU.o .shobj/BCU.: BCU.cpp BCU.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i
+.obj/CORBA_Utils_T.o .shobj/CORBA_Utils_T.: CORBA_Utils_T.cpp CORBA_Utils_T.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/managed_types.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/managed_types.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ CORBA_Utils_T.i
+.obj/Dispatching_Modules.o .shobj/Dispatching_Modules.: Dispatching_Modules.cpp \
+ $(ACE_ROOT)/ace/Sched_Params.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Sched_Params.i \
+ Memory_Pools.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ Event_Channel.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i CORBA_Utils_T.h CORBA_Utils_T.i Task_Manager.h \
+ RT_Task.h RT_Task.i Task_Manager.i ReactorTask.h Fast_Reactor.h \
+ $(ACE_ROOT)/ace/Select_Reactor.h \
+ $(ACE_ROOT)/ace/Token.h \
+ $(ACE_ROOT)/ace/Token.i \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(ACE_ROOT)/ace/Select_Reactor.i \
+ $(ACE_ROOT)/ace/Timer_Heap.h \
+ $(ACE_ROOT)/ace/Timer_Heap_T.h \
+ $(ACE_ROOT)/ace/Timer_List.h \
+ $(ACE_ROOT)/ace/Timer_List_T.h \
+ Event_Channel.i Dispatching_Modules.h Dispatching_Modules.i \
+ Memory_Pools.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.h \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.i
+.obj/Event_Channel.o .shobj/Event_Channel.: Event_Channel.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ Dispatching_Modules.h ReactorTask.h Fast_Reactor.h \
+ $(ACE_ROOT)/ace/Select_Reactor.h \
+ $(ACE_ROOT)/ace/Token.h \
+ $(ACE_ROOT)/ace/Token.i \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(ACE_ROOT)/ace/Select_Reactor.i \
+ $(ACE_ROOT)/ace/Timer_Heap.h \
+ $(ACE_ROOT)/ace/Timer_Heap_T.h \
+ $(ACE_ROOT)/ace/Timer_List.h \
+ $(ACE_ROOT)/ace/Timer_List_T.h \
+ Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i RT_Task.h RT_Task.i Event_Channel.h CORBA_Utils_T.h \
+ CORBA_Utils_T.i Task_Manager.h Task_Manager.i Event_Channel.i \
+ Dispatching_Modules.i Memory_Pools.h Memory_Pools.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.h \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Utilities.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Utilities.i
+.obj/GPlot_File.o .shobj/GPlot_File.: GPlot_File.cpp GPlot_File.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ GPlot_File.i
+.obj/Local_ESTypes.o .shobj/Local_ESTypes.: Local_ESTypes.cpp Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i
+.obj/Memory_Pools.o .shobj/Memory_Pools.: Memory_Pools.cpp Memory_Pools.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ Event_Channel.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i CORBA_Utils_T.h CORBA_Utils_T.i Task_Manager.h \
+ RT_Task.h RT_Task.i Task_Manager.i ReactorTask.h Fast_Reactor.h \
+ $(ACE_ROOT)/ace/Select_Reactor.h \
+ $(ACE_ROOT)/ace/Token.h \
+ $(ACE_ROOT)/ace/Token.i \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(ACE_ROOT)/ace/Select_Reactor.i \
+ $(ACE_ROOT)/ace/Timer_Heap.h \
+ $(ACE_ROOT)/ace/Timer_Heap_T.h \
+ $(ACE_ROOT)/ace/Timer_List.h \
+ $(ACE_ROOT)/ace/Timer_List_T.h \
+ Event_Channel.i Dispatching_Modules.h Dispatching_Modules.i \
+ Memory_Pools.i
+.obj/RT_Task.o .shobj/RT_Task.: RT_Task.cpp RT_Task.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/managed_types.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/managed_types.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ RT_Task.i Debug_Macros.h Event_Channel.h Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i CORBA_Utils_T.h CORBA_Utils_T.i Task_Manager.h \
+ Task_Manager.i ReactorTask.h Fast_Reactor.h \
+ $(ACE_ROOT)/ace/Select_Reactor.h \
+ $(ACE_ROOT)/ace/Token.h \
+ $(ACE_ROOT)/ace/Token.i \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(ACE_ROOT)/ace/Select_Reactor.i \
+ $(ACE_ROOT)/ace/Timer_Heap.h \
+ $(ACE_ROOT)/ace/Timer_Heap_T.h \
+ $(ACE_ROOT)/ace/Timer_List.h \
+ $(ACE_ROOT)/ace/Timer_List_T.h \
+ Event_Channel.i Memory_Pools.h Dispatching_Modules.h \
+ Dispatching_Modules.i Memory_Pools.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.h \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.i
+.obj/ReactorTask.o .shobj/ReactorTask.: ReactorTask.cpp \
+ $(ACE_ROOT)/ace/High_Res_Timer.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/High_Res_Timer.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/managed_types.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/managed_types.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.i \
+ ReactorTask.h Fast_Reactor.h \
+ $(ACE_ROOT)/ace/Select_Reactor.h \
+ $(ACE_ROOT)/ace/Token.h \
+ $(ACE_ROOT)/ace/Token.i \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(ACE_ROOT)/ace/Select_Reactor.i \
+ $(ACE_ROOT)/ace/Timer_Heap.h \
+ $(ACE_ROOT)/ace/Timer_Heap_T.h \
+ $(ACE_ROOT)/ace/Timer_List.h \
+ $(ACE_ROOT)/ace/Timer_List_T.h \
+ Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i RT_Task.h RT_Task.i
+.obj/Task_Manager.o .shobj/Task_Manager.: Task_Manager.cpp Task_Manager.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ RT_Task.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/managed_types.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/managed_types.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ RT_Task.i Task_Manager.i ReactorTask.h Fast_Reactor.h \
+ $(ACE_ROOT)/ace/Select_Reactor.h \
+ $(ACE_ROOT)/ace/Token.h \
+ $(ACE_ROOT)/ace/Token.i \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(ACE_ROOT)/ace/Select_Reactor.i \
+ $(ACE_ROOT)/ace/Timer_Heap.h \
+ $(ACE_ROOT)/ace/Timer_Heap_T.h \
+ $(ACE_ROOT)/ace/Timer_List.h \
+ $(ACE_ROOT)/ace/Timer_List_T.h \
+ Local_ESTypes.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminS.i \
+ Local_ESTypes.i
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/local/bin/Event_Service/Memory_Pools.cpp b/TAO/local/bin/Event_Service/Memory_Pools.cpp
new file mode 100644
index 00000000000..3cbcd71d8b5
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Memory_Pools.cpp
@@ -0,0 +1,33 @@
+// $Id$
+
+#include "Memory_Pools.h"
+#include "Event_Channel.h"
+
+#if !defined (__ACE_INLINE__)
+#include "Memory_Pools.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_TSS<ACE_ES_Dispatch_Request_Allocator> ACE_ES_Memory_Pools::Dispatch_Request_;
+ACE_TSS<ACE_ES_Event_Container_Allocator> ACE_ES_Memory_Pools::Event_Container_;
+ACE_TSS<ACE_ES_Event_Allocator> ACE_ES_Memory_Pools::Event_;
+
+// ************************************************************
+
+int
+ACE_ES_Memory_Pools::thr_init (void)
+{
+ // Allocate the memory pool for this thread.
+ Event_Container_.ts_object ();
+ Dispatch_Request_.ts_object ();
+ Event_.ts_object ();
+ return 0;
+}
+
+// ************************************************************
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+// For ACE_ES_Memory_Pools.
+template class ACE_TSS<ACE_ES_Event_Container_Allocator>;
+template class ACE_TSS<ACE_ES_Dispatch_Request_Allocator>;
+template class ACE_TSS<ACE_Malloc<ACE_Local_Memory_Pool, ACE_Local_Memory_Pool_Options, ACE_MEMORY_POOL_MUTEX> >;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/local/bin/Event_Service/Memory_Pools.h b/TAO/local/bin/Event_Service/Memory_Pools.h
new file mode 100644
index 00000000000..cc8a23f6767
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Memory_Pools.h
@@ -0,0 +1,104 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ORB Services
+//
+// = FILENAME
+// Memory_Pools
+//
+// = AUTHOR
+// Tim Harrison (harrison@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef ACE_MEMORY_POOLS_H
+#define ACE_MEMORY_POOLS_H
+
+#include "ace/Synch.h"
+#include "Event_Channel.h"
+#include "Dispatching_Modules.h"
+
+// ************************************************************
+
+#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)
+ typedef ACE_Null_Mutex ACE_MEMORY_POOL_MUTEX;
+#else
+ // Use the same object for each thread. Therefore, we have to use
+ // real synchronization.
+ typedef ACE_Thread_Mutex ACE_MEMORY_POOL_MUTEX;
+#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
+
+typedef char ACE_ES_Dispatch_Request_Chunk[sizeof (ACE_ES_Dispatch_Request)];
+
+typedef ACE_Cached_Allocator<ACE_ES_Dispatch_Request_Chunk, ACE_MEMORY_POOL_MUTEX> _ACE_Dispatch_Request_Allocator;
+
+class ACE_ES_Dispatch_Request_Allocator : public _ACE_Dispatch_Request_Allocator
+// = TITLE
+// Dispatch Request Allocator
+//
+// = DESCRIPTION
+// This just sets the size of the Event Container memory pool.
+{
+public:
+ ACE_ES_Dispatch_Request_Allocator (void) :
+ _ACE_Dispatch_Request_Allocator (ACE_ES_DISPATCH_REQUEST_MEMORY_POOL) {}
+};
+
+// ************************************************************
+
+typedef char ACE_ES_Event_Container_Chunk[sizeof (ACE_ES_Event_Container)];
+
+typedef ACE_Cached_Allocator<ACE_ES_Event_Container_Chunk, ACE_MEMORY_POOL_MUTEX> _ACE_Event_Container_Allocator;
+
+class ACE_ES_Event_Container_Allocator : public _ACE_Event_Container_Allocator
+// = TITLE
+// Event Container Allocator
+//
+// = DESCRIPTION
+// This just sets the size of the Event Container memory pool.
+{
+public:
+ ACE_ES_Event_Container_Allocator (void) :
+ _ACE_Event_Container_Allocator (ACE_ES_EVENT_CONTAINER_MEMORY_POOL) {}
+};
+
+// ************************************************************
+
+typedef char ACE_ES_Event_Chunk[sizeof (RtecEventComm::Event)];
+
+typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_MEMORY_POOL_MUTEX> ACE_ES_Event_Allocator;
+//typedef ACE_Cached_Allocator<ACE_ES_Event_Chunk, ACE_MEMORY_POOL_MUTEX> _ACE_Event_Allocator;
+
+class ACE_ES_Memory_Pools
+// = TITLE
+// Event Service Memory Pools.
+//
+// = DESCRIPTION
+// These have to be static in order to be accessed by operator
+// news, right?
+{
+public:
+ static int thr_init (void);
+ // This can be called by every thread that will access these memory
+ // pools to preallocate the thread specific allocators. It is not
+ // mandatory.
+
+ static void *new_Event_Container (void);
+ static void delete_Event_Container (void *);
+ static void *new_Dispatch_Request (void);
+ static void delete_Dispatch_Request (void *);
+ static void *new_Event (size_t);
+ static void delete_Event (void *);
+
+ static ACE_TSS<ACE_ES_Dispatch_Request_Allocator> Dispatch_Request_;
+ static ACE_TSS<ACE_ES_Event_Container_Allocator> Event_Container_;
+ static ACE_TSS<ACE_ES_Event_Allocator> Event_;
+};
+
+#if defined (__ACE_INLINE__)
+#include "Memory_Pools.i"
+#endif /* __ACE_INLINE__ */
+#endif /* ACE_MEMORY_POOLS_H */
diff --git a/TAO/local/bin/Event_Service/Memory_Pools.i b/TAO/local/bin/Event_Service/Memory_Pools.i
new file mode 100644
index 00000000000..3f6e3b26223
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Memory_Pools.i
@@ -0,0 +1,54 @@
+/* -*- C++ -*- */
+// $Id$
+
+ACE_INLINE void *
+ACE_ES_Memory_Pools::new_Event_Container (void)
+{
+ return Event_Container_->malloc (sizeof (ACE_ES_Event_Container));
+}
+
+ACE_INLINE void
+ACE_ES_Memory_Pools::delete_Event_Container (void *mem)
+{
+ Event_Container_->free (mem);
+}
+
+ACE_INLINE void *
+ACE_ES_Memory_Pools::new_Dispatch_Request (void)
+{
+ return Dispatch_Request_->malloc (sizeof (ACE_ES_Dispatch_Request));
+}
+
+ACE_INLINE void
+ACE_ES_Memory_Pools::delete_Dispatch_Request (void *mem)
+{
+ Dispatch_Request_->free (mem);
+}
+
+#define USE_MEM_POOLS 1
+
+ACE_INLINE void *
+ACE_ES_Memory_Pools::new_Event (size_t len)
+{
+#if USE_MEM_POOLS
+ const u_int ev_size = sizeof (RtecEventComm::Event);
+ const u_int size = (ev_size % ACE_MALLOC_ALIGN) ?
+ ((ev_size / ACE_MALLOC_ALIGN) + 1) * ACE_MALLOC_ALIGN : ev_size;
+
+ char *const addr = (char *) Event_->malloc (len * size);
+#else
+ char *const addr = new char[len * sizeof (ACE_ES_Event)];
+#endif
+
+ return addr;
+}
+
+ACE_INLINE void
+ACE_ES_Memory_Pools::delete_Event (void *mem)
+{
+#if USE_MEM_POOLS
+ Event_->free (mem);
+#else
+ delete [] mem;
+#endif
+}
diff --git a/TAO/local/bin/Event_Service/RT_Task.cpp b/TAO/local/bin/Event_Service/RT_Task.cpp
new file mode 100644
index 00000000000..79a7adeb47d
--- /dev/null
+++ b/TAO/local/bin/Event_Service/RT_Task.cpp
@@ -0,0 +1,357 @@
+// $Id$
+
+#include "RT_Task.h"
+#include "Debug_Macros.h"
+#include "Event_Channel.h"
+#include "Memory_Pools.h"
+#include "Scheduler_Factory.h"
+
+#if !defined (__ACE_INLINE__)
+#include "RT_Task.i"
+#endif /* __ACE_INLINE__ */
+
+class ACE_RT_Task_Shutdown : public ACE_RT_Task_Command
+// = TITLE
+// Flush Queue Command.
+//
+// = DESCRIPTION
+// This command object will call close on task_. This is used by
+// single-threaded tasks to flush any queued messages.
+{
+public:
+ ACE_RT_Task_Shutdown (ACE_ES_TASK *task)
+ : task_ (task) {}
+
+ virtual int execute (u_long &command_action);
+
+ ACE_ES_TASK *task_;
+};
+
+int
+ACE_RT_Task_Shutdown::execute (u_long &command_action)
+{
+ ACE_UNUSED_ARG (command_action);
+
+ if (task_ == 0)
+ return 1;
+ else
+ {
+ task_->close (0);
+ return 0;
+ }
+}
+
+// ************************************************************
+// ************************************************************
+
+ACE_RT_Task::ACE_RT_Task (void)
+ : closed_ (0)
+{
+}
+
+ACE_RT_Task::~ACE_RT_Task (void)
+{
+ msg_queue_->deactivate ();
+}
+
+int
+ACE_RT_Task::svc (void)
+{
+ int done = 0;
+
+ ACE_hthread_t self;
+ ACE_OS::thr_self (self);
+
+ int priority;
+ if (ACE_OS::thr_getprio (self, priority) == 0)
+ ACE_DEBUG ((LM_DEBUG, "(%t) new thread priority = %d.\n", priority));
+
+ // Initialize channel thread-specific data.
+ ACE_ES_Memory_Pools::thr_init ();
+
+ done = this->svc_hook (priority);
+
+ while (!done)
+ {
+ done = this->svc_one ();
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) thread exiting.\n"));
+ return 0;
+}
+
+int
+ACE_RT_Task::svc_hook (RtecScheduler::OS_Priority)
+{
+ return 0;
+}
+
+int
+ACE_RT_Task::svc_one (void)
+{
+ // Dequeue the command.
+ ACE_Message_Block *mb;
+
+ if (this->getq (mb) == -1)
+ {
+ if (ACE_OS::last_error () == ESHUTDOWN)
+ return 1;
+ else
+ // We'll continue in spite of this error.
+ ACE_ERROR ((LM_ERROR, "%p (%t) getq error.\n", "ACE_RT_Task::svc_one"));
+ }
+
+ // Execute the command.
+ ACE_RT_Task_Command *command = (ACE_RT_Task_Command *) mb;
+
+ int result;
+ u_long command_action = ACE_RT_Task_Command::RELEASE;
+
+ // @@ Put exception handling around this!
+ result = command->execute (command_action);
+
+ switch (command_action)
+ {
+ case ACE_RT_Task_Command::RELEASE:
+ // Free the message block.
+ if (ACE_RT_Task_Command::release (command) != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_RT_Task::svc_one: "
+ "ACE_RT_Task_Command::release returned != 0!\n"));
+ break;
+
+ case ACE_RT_Task_Command::UNGETQ:
+ this->ungetq (command);
+ break;
+ }
+
+ return result;
+}
+
+// A thread has exited.
+int
+ACE_RT_Task::close (u_long)
+{
+ // If we're the last one out, call threads_closed.
+ if (thr_count_ == 0)
+ this->threads_closed ();
+
+ return 0;
+}
+
+// All threads have exited.
+void
+ACE_RT_Task::threads_closed (void)
+{
+}
+
+int
+ACE_RT_Task::open_task (const char* name)
+{
+ const char *tempname = name;
+ char tempbuffer[64];
+ if (tempname == 0)
+ {
+ ACE_OS::sprintf (tempbuffer, "unnamed task %d", (long) this);
+ tempname = tempbuffer;
+ }
+
+ ACE_TRY
+ {
+ rt_info_ =
+ ACE_Scheduler_Factory::server()->create (tempname,
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ // @@ TODO: We do no initialization of the new rt_info, the
+ // caller does, this is (IMnsHO) very error prone.
+ }
+ ACE_CATCH (RtecScheduler::DUPLICATE_NAME, dn_ex)
+ {
+ // @@ TODO: Its already registered, IMHO this should at least
+ // report a warning, but I'll stick to the previous code.
+ // ACE_ERROR_RETURN ((LM_WARNING,
+ // "RT_Info for %s was already createn",
+ // tempname), 0);
+ return 0;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+int
+ACE_RT_Task::try_put (ACE_Message_Block *mb)
+{
+ if (!closed_)
+ {
+ return this->msg_queue ()->enqueue_prio (mb);
+ }
+ else
+ {
+ errno = EPIPE;
+ return -1;
+ }
+}
+
+// The point of this method is to spawn or shutdown threads depending
+// on any differences between the task's RT_Info::threads_ and how
+// many threads are actually running.
+int
+ACE_RT_Task::synch_threads (size_t threads)
+{
+ if (threads > this->thr_count ())
+ // Add threads.
+ {
+ RtecScheduler::OS_Priority thread_priority;
+ RtecScheduler::Sub_Priority subpriority;
+ RtecScheduler::Preemption_Priority preemption_priority;
+
+ ACE_TRY
+ {
+ // @@ TODO handle exceptions
+ ACE_Scheduler_Factory::server ()->priority
+ (rt_info_,
+ thread_priority,
+ subpriority,
+ preemption_priority, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) spawning %d threads at os thread"
+ " priority %d.\n",
+ threads - this->thr_count (),
+ thread_priority));
+
+ // This is here so that the constructor does not call it. The
+ // ORB has an instance of one of these.
+ this->thr_mgr (ACE_Task_Manager::instance ()->ThrMgr ());
+
+ // Add the difference.
+ if (this->activate (THR_BOUND,
+ threads - this->thr_count (),
+ 1, // Force it to spawn more threads
+ thread_priority) == -1)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ "(%t) thread spawn FAILED, errno is %d!!!!\n",
+ errno));
+ }
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "priority failed\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ }
+ else
+ // Remove threads.
+ {
+ // kill_threads has to be off the stack in case the last thread
+ // deletes this RT_Task.
+ int kill_threads = this->thr_count () - threads;
+
+ for (int x = kill_threads ; x > 0; x--)
+ {
+ // Create a new shutdown command with a task pointer of 0.
+ ACE_RT_Task_Shutdown *te = new ACE_RT_Task_Shutdown (0);
+
+ if (te == 0)
+ return -1;
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) enqueueing thread exit.\n"));
+ if (this->putq (te) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p putq failed.\n",
+ "ACE_RT_Task::synch_threads"));
+ if (ACE_RT_Task_Shutdown::release (te) != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_RT_Task::synch_threads: "
+ "ACE_RT_Task_Shutdown::release returned != 0!\n"));
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+// If we are not active, we will flush the queue and then call
+// this->close. Otherwise, we will send shutdown messages to each
+// thread. ~ACE_Task_Exit will call this->close when each thread
+// exits.
+int
+ACE_RT_Task::shutdown_task (void)
+{
+ // Be sure to only execute this once, and only if we're active.
+ if (closed_)
+ return 0;
+
+ // This will keep any messages from entering the queue.
+ closed_ = 1;
+
+ if (thr_count_ > 0)
+ return this->synch_threads (0);
+ else
+ {
+ // Create a new flush queue command. We're passive, so pass in
+ // a reference to the task for which close will be called.
+ ACE_RT_Task_Shutdown *fq = new ACE_RT_Task_Shutdown (this);
+
+ if (fq == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_RT_Task::shutdown_threads"));
+ return -1;
+ }
+
+ // Enqueue the command.
+ ACE_DEBUG ((LM_DEBUG, "(%t) enqueueing task shutdown.\n"));
+ if (this->putq (fq) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p putq failed.\n",
+ "ACE_RT_Task::shutdown_task"));
+ if (ACE_RT_Task_Shutdown::release (fq) != 0)
+ ACE_ERROR ((LM_ERROR, "ACE_RT_Task::shutdown_task: "
+ "ACE_RT_Task_Shutdown::release returned != 0!\n"));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+// ************************************************************
+
+ACE_RT_Thread_Manager::ACE_RT_Thread_Manager (void)
+ : flags_ (0)
+{
+}
+
+void
+ACE_RT_Thread_Manager::suspend_spawns (void)
+{
+ flags_ |= THR_SUSPENDED;
+}
+
+void
+ACE_RT_Thread_Manager::unsuspend_spawns (void)
+{
+ flags_ = 0;
+ this->resume_all ();
+}
+
+int
+ACE_RT_Thread_Manager::spawn_i (ACE_THR_FUNC func,
+ void *args,
+ long flags,
+ ACE_thread_t *t_id,
+ ACE_hthread_t *t_handle,
+ long priority,
+ int grp_id,
+ void *stack,
+ size_t stack_size,
+ ACE_Task_Base *task)
+{
+ flags |= flags_;
+ return ACE_Thread_Manager::spawn_i (func, args, flags, t_id, t_handle,
+ priority, grp_id, stack, stack_size, task);
+}
diff --git a/TAO/local/bin/Event_Service/RT_Task.h b/TAO/local/bin/Event_Service/RT_Task.h
new file mode 100644
index 00000000000..5a8f8d2445e
--- /dev/null
+++ b/TAO/local/bin/Event_Service/RT_Task.h
@@ -0,0 +1,179 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// RT_Task
+//
+// = AUTHOR
+// Tim Harrison (harrison@cs.wustl.edu)
+//
+// = DESCRIPTION
+// Wrapper on top of ACE Task that integrates an Active Object with
+// the COFP Scheduler and Event Service.
+//
+// ============================================================================
+
+#ifndef ACE_RT_TASK_H
+#define ACE_RT_TASK_H
+
+#include "ace/Task.h"
+
+#include "RtecSchedulerC.h"
+
+class ACE_RT_Thread_Manager : public ACE_Thread_Manager
+// = TITLE
+//
+// = DESCRIPTION
+{
+public:
+ ACE_RT_Thread_Manager (void);
+ // Default construction.
+
+ void suspend_spawns (void);
+ // Any threads spawned will be suspended until unsuspend_spawns is
+ // called.
+
+ void unsuspend_spawns (void);
+ // Resumes all threads.
+
+protected:
+ virtual int spawn_i (ACE_THR_FUNC func,
+ void *args,
+ long flags,
+ ACE_thread_t * = 0,
+ ACE_hthread_t *t_handle = 0,
+ long priority = 0,
+ int grp_id = -1,
+ void *stack = 0,
+ size_t stack_size = 0,
+ ACE_Task_Base *task = 0);
+
+ int flags_;
+};
+
+// ************************************************************
+
+class ACE_RT_Task_Command : public ACE_Message_Block
+// = TITLE
+//
+// = DESCRIPTION
+{
+public:
+ virtual ~ACE_RT_Task_Command (void) {}
+ // Guarantees that derived destructors get called.
+
+ enum { RELEASE, UNGETQ };
+
+ virtual int execute (u_long &command_action) = 0;
+ // Execute the command. Returning 1 will make the calling thread
+ // exit. Returning 0 will allow the thread to continue dispatching
+ // commands. If <command_action> returns as RELEASE, the command
+ // will be released. If <command_action> == UNGETQ, then the
+ // command will be requeued and dispatched again.
+};
+
+// ************************************************************
+
+// In Synch_T.h:
+// #define ACE_MT_SYNCH ACE_Thread_Mutex,ACE_Condition_Thread_Mutex
+
+typedef ACE_Task<ACE_MT_SYNCH> ACE_ES_TASK;
+typedef ACE_Message_Queue<ACE_MT_SYNCH> ACE_ES_QUEUE;
+
+class ACE_RT_Task : public ACE_ES_TASK
+// = TITLE
+// ACE Real-Time Task
+//
+// = DESCRIPTION
+// Real-Time Active Object that integrates with a global scheduler
+// and Event Service. For now, none of the management methods are
+// synchronized. If it turns out that multiple threads will be
+// calling the management methods, then we can add
+// synchronization. For the most part, RT_Task threads should be
+// dequeueing commands from the message queue. Only one thread
+// should be calling any management methods.
+{
+ friend ACE_RT_Thread_Manager;
+public:
+ ACE_RT_Task (void);
+ // Default construction.
+
+ ~ACE_RT_Task (void);
+ // Deactivates the queue.
+
+ // = Management methods.
+
+ int open_task (const char* name = 0);
+ // <name> is used to look up our qos info from the scheduler. If
+ // <name> == 0, then we create a "unique" name and ask the scheduler
+ // for a new qos structure. If we find an existing qos structure,
+ // calls this->synch_threads and returns 1. If a qos structure is not
+ // found, but created returns 0 and does not call synch_threads.
+ // Returns -1 on failure.
+
+ int try_put (ACE_Message_Block *mb);
+ // Enqueue a request. Returns 0 on success, -1 on failure. If the
+ // task is shutdown, -1 is returned with errno == EPIPE.
+
+ int shutdown_task (void);
+ // If active, shutdown all running thread. Since this is
+ // accomplished via queued shutdown messages, this has the effect of
+ // flushing the queue. Once all threads exit, threads_closed will
+ // be called. If this is a passive object, then the queue will be
+ // flushed and threads_closed will be called.
+
+ int synch_threads (size_t threads);
+ // Compare <threads> with what is actually running. If there are
+ // any differences, update this RT_Task. This may involve spawning
+ // more threads or changing thread priorities, etc. This can be
+ // used to close all threads by sending a 0.
+
+ RtecScheduler::handle_t rt_info (void);
+ // QOS accessor. The behavior of the task can be changed by setting
+ // this and then calling this->synch_threads.
+
+ virtual void threads_closed (void);
+ // Called when every thread has exited. This hook allows
+ // applications to specify semantics when all threads have exited.
+ // For instance, the Dispatching Module uses this hook to delete
+ // itself when an application is shutting down.
+
+ virtual int svc_hook (RtecScheduler::OS_Priority priority);
+ // This is called the first time the thread is spawned. <priority>
+ // is the priority of the current thread. If this returns != 1
+ // (e.g., 0), the event loop will execute (calling this->svc_one).
+ // If this returns 1, the event loop will not execute.
+
+ virtual int svc_one (void);
+ // Call this->getq once and execute the command. Returns the result
+ // of command->execute ().
+
+protected:
+ RtecScheduler::handle_t rt_info_;
+ // Scheduling characteristics of this active object.
+
+ int closed_;
+ // Set to 1 when this->shutdown_threads or this->close_queue is
+ // called. Keeps us from enqueuing more that one shutdown message.
+
+ virtual int svc (void);
+ // Run by each thread spawned. Each thread dequeues
+ // ACE_RT_Task_Commands and executes them.
+
+ virtual int close (u_long flags = 0);
+ // Called each time a thread exits.
+
+ void close_all_threads (void);
+ // Enqueues shutdown message for every thread in the task.
+};
+
+#if defined (__ACE_INLINE__)
+#include "RT_Task.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* ACE_RT_TASK_H */
diff --git a/TAO/local/bin/Event_Service/RT_Task.i b/TAO/local/bin/Event_Service/RT_Task.i
new file mode 100644
index 00000000000..b6b21d50494
--- /dev/null
+++ b/TAO/local/bin/Event_Service/RT_Task.i
@@ -0,0 +1,8 @@
+/* -*- C++ -*- */
+// $Id$
+
+ACE_INLINE RtecScheduler::handle_t
+ACE_RT_Task::rt_info (void)
+{
+ return rt_info_;
+}
diff --git a/TAO/local/bin/Event_Service/ReactorTask.cpp b/TAO/local/bin/Event_Service/ReactorTask.cpp
new file mode 100644
index 00000000000..4200eeaa933
--- /dev/null
+++ b/TAO/local/bin/Event_Service/ReactorTask.cpp
@@ -0,0 +1,107 @@
+//
+// $Id$
+//
+#include "ace/High_Res_Timer.h"
+
+#include "Scheduler_Factory.h"
+#include "ReactorTask.h"
+
+ACE_ES_Reactor_Task::ACE_ES_Reactor_Task() :
+ // reactor_ (0, &timer_queue_),
+ done_ (0)
+{
+ // Change the timer mechanism used by the reactor and the timer
+ // queue.
+#if defined (VXWORKS)
+ timer_queue_.gettimeofday (ACE_OS::gettimeofday);
+#else
+ timer_queue_.gettimeofday (ACE_High_Res_Timer::gettimeofday);
+#endif /* VXWORKS */
+}
+
+ACE_ES_Reactor_Task::~ACE_ES_Reactor_Task (void)
+{
+}
+
+int
+ACE_ES_Reactor_Task::svc_hook(RtecScheduler::OS_Priority)
+{
+ // Make ourselves owner of the reactor.
+ reactor_.owner (ACE_Thread::self());
+ return 0;
+}
+
+int
+ACE_ES_Reactor_Task::open_reactor (RtecScheduler::Period &period)
+{
+ // Create a name for ourself using the priority.
+ char temp[64];
+ ACE_OS::sprintf (temp, "Reactor_Task-%u", period);
+
+ // Open the task. This will query the scheduler for our qos
+ // structure.
+ int result = this->open_task (temp);
+
+ switch (result)
+ {
+ case -1:
+ // Error.
+ ACE_ERROR ((LM_ERROR, "(%t) Scheduler could not find operation %s.\n",
+ temp));
+ return -1;
+
+ case 0:
+ // @@ TODO handle exceptions
+ {
+ ACE_TRY
+ {
+ ACE_Scheduler_Factory::server()->set(rt_info_,
+ 0, 0, 0, period,
+ RtecScheduler::VERY_LOW,
+ RtecScheduler::NO_QUANTUM,
+ 1, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "set failed\n"), -1);
+ }
+ ACE_ENDTRY;
+ }
+ break;
+
+ case 1:
+ // Found.
+ break;
+ }
+
+ return this->synch_threads (1);
+}
+
+int ACE_ES_Reactor_Task::svc_one()
+{
+ if (reactor_.handle_events() == -1)
+ ACE_ERROR ((LM_ERROR, "(%t) %p.\n", "ACE_ES_Reactor_Task::svc"));
+
+ if (done_)
+ ACE_DEBUG ((LM_DEBUG, "(%t) Timer Task is done.\n"));
+
+ return done_;
+}
+
+void ACE_ES_Reactor_Task::threads_closed()
+{
+ delete this;
+}
+
+void ACE_ES_Reactor_Task::shutdown_task()
+{
+ done_ = 1;
+ reactor_.notify();
+}
+
+ACE_ES_Reactor_Task::Reactor&
+ACE_ES_Reactor_Task::get_reactor()
+{
+ return reactor_;
+}
diff --git a/TAO/local/bin/Event_Service/ReactorTask.h b/TAO/local/bin/Event_Service/ReactorTask.h
new file mode 100644
index 00000000000..61a5a93c6ae
--- /dev/null
+++ b/TAO/local/bin/Event_Service/ReactorTask.h
@@ -0,0 +1,77 @@
+// $Id$
+
+#if !defined ACE_ReactorTask_H
+#define ACE_ReactorTask_H
+
+// BBM, moved this here from UPSingleProcessorOrb.h
+//## begin module.includes preserve=yes
+#include "Fast_Reactor.h"
+#if defined (ACE_OLD_STYLE_REACTOR)
+# define ACE_ORB_REACTOR ACE_ES_Fast_Reactor
+#endif /* ACE_OLD_STYLE_REACTOR */
+//## end module.includes
+
+// Added these.
+#include "ace/Timer_Heap.h"
+#include "ace/Timer_List.h"
+
+#include "Local_ESTypes.h"
+#include "RT_Task.h"
+
+class ACE_ES_Reactor_Task : public ACE_RT_Task
+// = TITLE
+// Event Service Timer Task
+//
+// = DESCRIPTION
+// An active object that dispatches timers from its own ReactorEx.
+{
+public:
+ // BBM, added this.
+#if defined (ACE_OLD_STYLE_REACTOR)
+ typedef ACE_ORB_REACTOR Reactor;
+#else
+ typedef ACE_Reactor Reactor;
+#endif /* ACE_OLD_STYLE_REACTOR */
+
+ ACE_ES_Reactor_Task();
+ // Default construction.
+
+ ~ACE_ES_Reactor_Task();
+ // Destruction.
+
+ virtual int svc_hook(RtecScheduler::OS_Priority);
+ // Assume ownership of the reactor_.
+
+ // Brian, this is new.
+ int open_reactor (RtecScheduler::Period &period);
+ // This is a hack for now.
+
+ virtual int svc_one();
+ // Calls reactor_.handle_events until done_ is set.
+
+ void shutdown_task();
+ // Sets done_ and notifies the reactor_.
+
+ Reactor &get_reactor();
+ // ReactorEx accessor.
+
+ virtual void threads_closed();
+ // Deletes this.
+
+private:
+ ACE_Timer_List timer_queue_;
+ // The timer storage mechanism used by reactor_.
+
+#if !defined (ACE_OLD_STYLE_REACTOR)
+ ACE_ES_Fast_Reactor fast_reactor_;
+ // The timer dispatch mechanism.
+#endif /* ! ACE_OLD_STYLE_REACTOR */
+
+ Reactor reactor_;
+ // "Public" handle to fast_reactor_.
+
+ sig_atomic_t done_;
+ // When set, end the event loop.
+};
+
+#endif /* ACE_ReactorTask_H */
diff --git a/TAO/local/bin/Event_Service/Task_Manager.cpp b/TAO/local/bin/Event_Service/Task_Manager.cpp
new file mode 100644
index 00000000000..e90ee3682da
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Task_Manager.cpp
@@ -0,0 +1,37 @@
+// $Id$
+
+#include "Task_Manager.h"
+#include "ReactorTask.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "Task_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_Task_Manager::ACE_Task_Manager()
+{
+ for (int x=0; x < ACE_Scheduler_MAX_PRIORITIES; x++)
+ {
+ reactorTasks[x] = 0;
+ }
+}
+
+void ACE_Task_Manager::initialize()
+{
+ for (int x=0; x < ACE_Scheduler_MAX_PRIORITIES; x++)
+ {
+ RtecScheduler::Period tv = ACE_Scheduler_Rates[x];
+ reactorTasks[x] = new ReactorTask;
+ if (reactorTasks[x] == 0 ||
+ reactorTasks[x]->open_reactor (tv) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p.\n", "ACE_ORB::initialize_reactors"));
+ return;
+ }
+ }
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Singleton<ACE_Task_Manager,ACE_SYNCH_MUTEX>;
+#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate class ACE_Singleton<ACE_Task_Manager,ACE_SYNCH_MUTEX>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/local/bin/Event_Service/Task_Manager.h b/TAO/local/bin/Event_Service/Task_Manager.h
new file mode 100644
index 00000000000..d87693d024b
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Task_Manager.h
@@ -0,0 +1,56 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+
+#if !defined(TASK_MANAGER_H)
+#define TASK_MANAGER_H
+
+#include <ace/ACE.h>
+#include <ace/Singleton.h>
+#include "Event_Service_Constants.h"
+#include "RT_Task.h"
+
+class ACE_ES_Reactor_Task;
+
+class ACE_Task_Manager
+// = TITLE
+// Singleton class for the pool of ACE_ReactorTask.
+//
+// = DESCRIPTION
+// The EventChannel uses a pool of ACE_ReactorTask to handle the
+// dispatching of Events. In real-time multi-threaded enviroments
+// this maps to a different thread per priority.
+// This class offers a centralized access point to those tasks and
+// some related services.
+//
+{
+public:
+ typedef ACE_ES_Reactor_Task ReactorTask;
+
+ static ACE_Task_Manager* instance();
+ // Returns the singleton.
+
+ ReactorTask* GetReactorTask(RtecScheduler::OS_Priority priority);
+ // Obtain the ReactorTask for the given priority.
+ // The Task must have been created already.
+
+ ACE_RT_Thread_Manager* ThrMgr();
+ // Returns a global ThreadManager for the Task pool.
+
+private:
+ friend class ACE_Singleton<ACE_Task_Manager,ACE_SYNCH_MUTEX>;
+ ACE_Task_Manager();
+
+ void initialize();
+
+private:
+ ReactorTask *reactorTasks[ACE_Scheduler_MAX_PRIORITIES];
+ ACE_RT_Thread_Manager thr_mgr;
+};
+
+#if defined (__ACE_INLINE__)
+#include "Task_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TASK_MANAGER_H */
diff --git a/TAO/local/bin/Event_Service/Task_Manager.i b/TAO/local/bin/Event_Service/Task_Manager.i
new file mode 100644
index 00000000000..35abcc0268c
--- /dev/null
+++ b/TAO/local/bin/Event_Service/Task_Manager.i
@@ -0,0 +1,30 @@
+//
+// $Id$
+//
+
+ACE_INLINE ACE_Task_Manager::ReactorTask*
+ACE_Task_Manager::GetReactorTask(RtecScheduler::OS_Priority priority)
+{
+ if (reactorTasks[priority] == 0)
+ {
+ initialize();
+ //ACE_ERROR_RETURN ((LM_ERROR,
+ //"%p no reactor task for priority %d.\n",
+ //"ACE_Task_Manager::GetReactor",
+ //priority), 0);
+ }
+
+ return reactorTasks[priority];
+}
+
+ACE_INLINE ACE_RT_Thread_Manager* ACE_Task_Manager::ThrMgr()
+{
+ return &thr_mgr;
+}
+
+ACE_INLINE ACE_Task_Manager* ACE_Task_Manager::instance()
+{
+ return ACE_Singleton<ACE_Task_Manager,ACE_SYNCH_MUTEX>::instance();
+}
+
+
diff --git a/TAO/local/bin/Makefile b/TAO/local/bin/Makefile
new file mode 100644
index 00000000000..08a276608b0
--- /dev/null
+++ b/TAO/local/bin/Makefile
@@ -0,0 +1,23 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+DIRS = Event_Service \
+ Scheduling_Service
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU
+
diff --git a/TAO/local/bin/Scheduling_Service/.cvsignore b/TAO/local/bin/Scheduling_Service/.cvsignore
new file mode 100644
index 00000000000..ffbc428cd7f
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/.cvsignore
@@ -0,0 +1,3 @@
+schedule_service
+dump_schedule
+
diff --git a/TAO/local/bin/Scheduling_Service/Config_Scheduler.cpp b/TAO/local/bin/Scheduling_Service/Config_Scheduler.cpp
new file mode 100644
index 00000000000..63b8122c180
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Config_Scheduler.cpp
@@ -0,0 +1,256 @@
+// ============================================================================
+//
+// $Id$
+//
+// ============================================================================
+
+#include "Scheduler_Internal.h"
+#include "Config_Scheduler.h"
+
+#if defined (__ACE_INLINE__)
+#include "Config_Scheduler.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_Config_Scheduler::ACE_Config_Scheduler (void)
+ : POA_RtecScheduler::Scheduler ("Scheduler_Internal"),
+ impl(new Scheduler_Internal)
+{
+ impl->output_level (10);
+}
+
+ACE_Config_Scheduler::~ACE_Config_Scheduler (void)
+{
+ delete impl;
+}
+
+RtecScheduler::handle_t
+ACE_Config_Scheduler::create (const char * entry_point,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::DUPLICATE_NAME))
+{
+ typedef RtecScheduler::RT_Info* RT_Info_ptr;
+
+ RtecScheduler::RT_Info** rt_info;
+ ACE_NEW_RETURN (rt_info, RT_Info_ptr[1], -1);
+
+ ACE_NEW_RETURN (rt_info[0], RtecScheduler::RT_Info, -1);
+
+ rt_info[0]->entry_point = CORBA::string_dup(entry_point);
+ rt_info[0]->handle = -1;
+ rt_info[0]->worst_case_execution_time = 0;
+ rt_info[0]->typical_execution_time = 0;
+ rt_info[0]->cached_execution_time = 0;
+ rt_info[0]->period = 0;
+ rt_info[0]->importance = RtecScheduler::VERY_LOW;
+ rt_info[0]->quantum = RtecScheduler::NO_QUANTUM;
+ rt_info[0]->threads = 0;
+ rt_info[0]->priority = 0;
+ rt_info[0]->subpriority = 0;
+ rt_info[0]->preemption_priority = 0;
+
+ RtecScheduler::handle_t handle = -1;
+ switch (impl->register_task (rt_info, 1, handle))
+ {
+ case ACE_Scheduler::SUCCEEDED:
+ break;
+ case ACE_Scheduler::ST_VIRTUAL_MEMORY_EXHAUSTED:
+ case ACE_Scheduler::ST_TASK_ALREADY_REGISTERED:
+ default:
+ delete rt_info[0];
+ delete[] rt_info;
+ ACE_ERROR ((LM_ERROR,
+ "Config_Scheduler::create - register_task failed\n"));
+ // TODO: throw something.
+ break;
+ }
+ return handle;
+}
+
+RtecScheduler::handle_t
+ACE_Config_Scheduler::lookup (const char * entry_point,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RtecScheduler::RT_Info* rt_info = 0;
+ switch (impl->get_rt_info (entry_point, rt_info))
+ {
+ case ACE_Scheduler::SUCCEEDED:
+ return rt_info->handle;
+ break;
+ case ACE_Scheduler::FAILED:
+ case ACE_Scheduler::ST_UNKNOWN_TASK:
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "Config_Scheduler::lookup - get_rt_info failed\n"));
+ // TODO: throw something.
+ break;
+ }
+ return -1;
+}
+
+RtecScheduler::RT_Info*
+ACE_Config_Scheduler::get (RtecScheduler::handle_t handle,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK))
+{
+ RtecScheduler::RT_Info* rt_info = 0;
+ switch (impl->lookup_rt_info (handle, rt_info))
+ {
+ case ACE_Scheduler::SUCCEEDED:
+ {
+ // IDL memory managment semantics require the we return a copy
+ RtecScheduler::RT_Info* copy;
+ ACE_NEW_RETURN (copy, RtecScheduler::RT_Info (*rt_info), 0);
+ return copy;
+ }
+ break;
+ case ACE_Scheduler::FAILED:
+ case ACE_Scheduler::ST_UNKNOWN_TASK:
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "Config_Scheduler::get - lookup_rt_info failed\n"));
+ // TODO: throw something.
+ break;
+ }
+ return 0;
+}
+
+void ACE_Config_Scheduler::set (RtecScheduler::handle_t handle,
+ RtecScheduler::Time time,
+ RtecScheduler::Time typical_time,
+ RtecScheduler::Time cached_time,
+ RtecScheduler::Period period,
+ RtecScheduler::Importance importance,
+ RtecScheduler::Quantum quantum,
+ CORBA::Long threads,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK))
+{
+ RtecScheduler::RT_Info* rt_info = 0;
+ switch (impl->lookup_rt_info (handle, rt_info))
+ {
+ case ACE_Scheduler::SUCCEEDED:
+ rt_info->worst_case_execution_time = time;
+ rt_info->typical_execution_time = typical_time;
+ rt_info->cached_execution_time = cached_time;
+ rt_info->period = period;
+ rt_info->importance = importance;
+ rt_info->quantum = quantum;
+ rt_info->threads = threads;
+ break;
+ case ACE_Scheduler::FAILED:
+ case ACE_Scheduler::ST_UNKNOWN_TASK:
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "Config_Scheduler::set - lookup_rt_info failed\n"));
+ // TODO: throw something.
+ break;
+ }
+}
+
+void ACE_Config_Scheduler::priority (RtecScheduler::handle_t handle,
+ RtecScheduler::OS_Priority& priority,
+ RtecScheduler::Sub_Priority& subpriority,
+ RtecScheduler::Preemption_Priority& p_priority,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK,
+ RtecScheduler::NOT_SCHEDULED))
+{
+ if (impl->priority (handle, priority, subpriority, p_priority) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Config_Scheduler::priority - priority failed\n"));
+ // TODO: throw something.
+ }
+}
+
+void ACE_Config_Scheduler::entry_point_priority (const char * entry_point,
+ RtecScheduler::OS_Priority& priority,
+ RtecScheduler::Sub_Priority& subpriority,
+ RtecScheduler::Preemption_Priority& p_priority,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK,
+ RtecScheduler::NOT_SCHEDULED))
+{
+ this->priority (lookup (entry_point, _env),
+ priority, subpriority, p_priority,
+ _env);
+}
+
+void ACE_Config_Scheduler::add_dependency (RtecScheduler::handle_t handle,
+ RtecScheduler::handle_t dependency,
+ CORBA::Long number_of_calls,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK))
+{
+ RtecScheduler::RT_Info* rt_info = 0;
+ switch (impl->lookup_rt_info (handle, rt_info))
+ {
+ case ACE_Scheduler::SUCCEEDED:
+ {
+ RtecScheduler::Dependency_Info dep;
+ dep.rt_info = dependency;
+ dep.number_of_calls = number_of_calls;
+ ACE_Scheduler::add_dependency(rt_info, dep);
+ }
+ break;
+ case ACE_Scheduler::FAILED:
+ case ACE_Scheduler::ST_UNKNOWN_TASK:
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "cannot find %d to add dependency", handle));
+ // TODO: throw something.
+ break;
+ }
+}
+
+void ACE_Config_Scheduler::compute_scheduling (CORBA::Long minimum_priority,
+ CORBA::Long maximum_priority,
+ RtecScheduler::RT_Info_Set_out infos,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::UTILIZATION_BOUND_EXCEEDED,
+ RtecScheduler::INSUFFICIENT_THREAD_PRIORITY_LEVELS,
+ RtecScheduler::TASK_COUNT_MISMATCH))
+{
+ impl->init (minimum_priority, maximum_priority);
+ if (impl->schedule () != ACE_Scheduler::SUCCEEDED)
+ {
+ // TODO: throw something.
+ ACE_ERROR ((LM_ERROR, "schedule failed\n"));
+ return;
+ }
+ if (infos == 0)
+ {
+ infos = new RtecScheduler::RT_Info_Set(impl->tasks ());
+ }
+ infos->length (impl->tasks ());
+ for (RtecScheduler::handle_t handle = 1;
+ handle <= impl->tasks ();
+ ++handle)
+ {
+ RtecScheduler::RT_Info* rt_info = 0;
+ switch (impl->lookup_rt_info (handle, rt_info))
+ {
+ case ACE_Scheduler::SUCCEEDED:
+ // We know that handles start at 1.
+ (*infos)[handle - 1] = *rt_info;
+ break;
+ case ACE_Scheduler::FAILED:
+ case ACE_Scheduler::ST_UNKNOWN_TASK:
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "Config_Scheduler::schedule - lookup_rt_info failed\n"));
+ // TODO: throw something.
+ break;
+ }
+ }
+ ACE_DEBUG ((LM_DEBUG, "schedule prepared\n"));
+ // TODO: Extract data.
+}
diff --git a/TAO/local/bin/Scheduling_Service/Config_Scheduler.h b/TAO/local/bin/Scheduling_Service/Config_Scheduler.h
new file mode 100644
index 00000000000..7da2739d2ec
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Config_Scheduler.h
@@ -0,0 +1,94 @@
+// ============================================================================
+//
+// $Id$
+//
+// ============================================================================
+
+#ifndef ACE_CONFIG_SCHEDULER_H
+#define ACE_CONFIG_SCHEDULER_H
+
+#include <ace/OS.h>
+
+#include "RtecSchedulerS.h"
+#include "Event_Service_Constants.h"
+
+class ACE_Config_Scheduler
+: public POA_RtecScheduler::Scheduler
+ // = TITLE
+ // A (local) implementation for the RtecScheduler::Scheduler service.
+ //
+ // = DESCRIPTION
+ // This class implements a servant for the
+ // RtecScheduler::Scheduler service, using the Scheduler classes
+ // distributed with the EC.
+{
+public:
+ ACE_Config_Scheduler (void);
+ virtual ~ACE_Config_Scheduler (void);
+
+ virtual RtecScheduler::handle_t create (const char * entry_point,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException, RtecScheduler::DUPLICATE_NAME));
+
+ virtual RtecScheduler::handle_t lookup (const char * entry_point,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC((CORBA::SystemException));
+
+ virtual RtecScheduler::RT_Info* get (RtecScheduler::handle_t handle,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException, RtecScheduler::UNKNOWN_TASK));
+
+ virtual void set (RtecScheduler::handle_t handle,
+ RtecScheduler::Time time,
+ RtecScheduler::Time typical_time,
+ RtecScheduler::Time cached_time,
+ RtecScheduler::Period period,
+ RtecScheduler::Importance importance,
+ RtecScheduler::Quantum quantum,
+ CORBA::Long threads,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException, RtecScheduler::UNKNOWN_TASK));
+
+ virtual void priority (RtecScheduler::handle_t handle,
+ RtecScheduler::OS_Priority& priority,
+ RtecScheduler::Sub_Priority& subpriority,
+ RtecScheduler::Preemption_Priority& p_priority,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK,
+ RtecScheduler::NOT_SCHEDULED));
+
+ virtual void entry_point_priority (const char * entry_point,
+ RtecScheduler::OS_Priority& priority,
+ RtecScheduler::Sub_Priority& subpriority,
+ RtecScheduler::Preemption_Priority& p_priority,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK,
+ RtecScheduler::NOT_SCHEDULED));
+
+ virtual void add_dependency (RtecScheduler::handle_t handle,
+ RtecScheduler::handle_t dependency,
+ CORBA::Long number_of_calls,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RtecScheduler::UNKNOWN_TASK));
+
+ virtual void compute_scheduling (CORBA::Long minimum_priority,
+ CORBA::Long maximum_priority,
+ RtecScheduler::RT_Info_Set_out infos,
+ CORBA::Environment &_env)
+ ACE_THROW_SPEC((CORBA::SystemException,
+ RtecScheduler::UTILIZATION_BOUND_EXCEEDED,
+ RtecScheduler::INSUFFICIENT_THREAD_PRIORITY_LEVELS,
+ RtecScheduler::TASK_COUNT_MISMATCH));
+
+private:
+ class ACE_Scheduler* impl;
+};
+
+#if defined (__ACE_INLINE__)
+#include "Config_Scheduler.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* ACE_CONFIG_SCHEDULER_H */
diff --git a/TAO/local/bin/Scheduling_Service/Config_Scheduler.i b/TAO/local/bin/Scheduling_Service/Config_Scheduler.i
new file mode 100644
index 00000000000..a21ea7f9897
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Config_Scheduler.i
@@ -0,0 +1,5 @@
+// ============================================================================
+//
+// $Id$
+//
+// ============================================================================
diff --git a/TAO/local/bin/Scheduling_Service/Makefile b/TAO/local/bin/Scheduling_Service/Makefile
new file mode 100644
index 00000000000..cb31ad2deab
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Makefile
@@ -0,0 +1,752 @@
+#
+# $Id$
+#
+
+BIN = schedule_service dump_schedule
+BUILD = $(BIN)
+
+SCHEDULE_SRCS = \
+ schedule_service.cpp \
+ Config_Scheduler.cpp \
+ Scheduler.cpp \
+ Scheduler_Internal.cpp
+DUMP_SRCS = \
+ dump_schedule.cpp
+
+LSRC = $(SCHEDULE_SRCS) \
+ $(DUMP_SRCS)
+
+SCHEDULE_OBJS=$(SCHEDULE_SRCS:.cpp=.o)
+DUMP_OBJS=$(DUMP_SRCS:.cpp=.o)
+
+LDLIBS = -lorbsvcs -lTAO
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+ifndef TAO_ROOT
+TAO_ROOT = $(ACE_ROOT)/TAO
+endif
+TSS_ORB_FLAG = #-DTAO_HAS_TSS_ORBCORE
+DCFLAGS = -g
+LDFLAGS += -L$(TAO_ROOT)/orbsvcs/lib -L$(TAO_ROOT)/tao
+CPPFLAGS += -I$(TAO_ROOT)/orbsvcs/lib -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat $(TSS_ORB_FLAG)#-H
+
+schedule_service: $(addprefix $(VDIR),$(SCHEDULE_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+dump_schedule: $(addprefix $(VDIR),$(DUMP_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/schedule_service.o .shobj/schedule_service.: schedule_service.cpp \
+ $(ACE_ROOT)/ace/CORBA_Handler.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Pipe.h \
+ $(ACE_ROOT)/ace/Pipe.i \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ Config_Scheduler.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ Config_Scheduler.i
+.obj/Config_Scheduler.o .shobj/Config_Scheduler.: Config_Scheduler.cpp Scheduler_Internal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Containers.i \
+ Scheduler.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ Scheduler.i Scheduler_Internal.i Config_Scheduler.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerS.i \
+ Config_Scheduler.i
+.obj/Scheduler.o .shobj/Scheduler.: Scheduler.cpp \
+ $(ACE_ROOT)/ace/Sched_Params.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Sched_Params.i \
+ Scheduler_Internal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ Scheduler.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ Scheduler.i Scheduler_Internal.i
+.obj/Scheduler_Internal.o .shobj/Scheduler_Internal.: Scheduler_Internal.cpp \
+ \
+ \
+ $(ACE_ROOT)/ace/Sched_Params.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Sched_Params.i \
+ Scheduler_Internal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ Scheduler.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ Scheduler.i Scheduler_Internal.i
+.obj/dump_schedule.o .shobj/dump_schedule.: dump_schedule.cpp \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.i
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/local/bin/Scheduling_Service/Scheduler.cpp b/TAO/local/bin/Scheduling_Service/Scheduler.cpp
new file mode 100644
index 00000000000..460a1862710
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Scheduler.cpp
@@ -0,0 +1,291 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// sched
+//
+// = FILENAME
+// Scheduler.cpp
+//
+// = CREATION DATE
+// 23 January 1997
+//
+// = AUTHOR
+// David Levine
+//
+// ============================================================================
+
+#include "ace/Sched_Params.h"
+#include "Scheduler_Internal.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "Scheduler.i"
+#endif /* __ACE_INLINE__ */
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// class Scheduler static members
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+const ACE_Scheduler::mode_t ACE_Scheduler::CURRENT_MODE = 0xFFFFFFFF;
+
+ACE_Scheduler *ACE_Scheduler::instance_ = 0;
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// class ACE_Scheduler static functions
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+void
+ACE_Scheduler::output (FILE *file, const status_t status)
+{
+ switch (status)
+ {
+ case NOT_SCHEDULED :
+ ACE_OS::fprintf (file, "NOT_SCHEDULED");
+ break;
+ case SUCCEEDED :
+ ACE_OS::fprintf (file, "SUCCEEDED");
+ break;
+ case ST_TASK_ALREADY_REGISTERED :
+ ACE_OS::fprintf (file, "TASK_ALREADY_REGISTERED");
+ break;
+ case ST_VIRTUAL_MEMORY_EXHAUSTED :
+ ACE_OS::fprintf (file, "VIRTUAL_MEMORY_EXHAUSTED");
+ break;
+ case ST_UNKNOWN_TASK :
+ ACE_OS::fprintf (file, "UNKNOWN_TASK");
+ break;
+ case INVALID_MODE :
+ ACE_OS::fprintf (file, "INVALID_MODE");
+ break;
+ case MODE_COUNT_MISMATCH :
+ ACE_OS::fprintf (file, "MODE_COUNT_MISMATCH");
+ break;
+ case TASK_COUNT_MISMATCH :
+ ACE_OS::fprintf (file, "TASK_COUNT_MISMATCH");
+ break;
+ case INVALID_PRIORITY :
+ ACE_OS::fprintf (file, "INVALID_PRIORITY");
+ break;
+
+ // The following are only used during scheduling (in the case of
+ // off-line scheduling, they are only used prior to runtime).
+ // To save a little code space (280 bytes on g++ 2.7.2/Solaris 2.5.1),
+ // we could conditionally compile them so that they're not in the
+ // runtime version.
+ case ST_UTILIZATION_BOUND_EXCEEDED :
+ ACE_OS::fprintf (file, "UTILIZATION_BOUND_EXCEEDED");
+ break;
+ case ST_INSUFFICIENT_THREAD_PRIORITY_LEVELS :
+ ACE_OS::fprintf (file, "INSUFFICIENT_THREAD_PRIORITY_LEVELS");
+ break;
+ case ST_CYCLE_IN_DEPENDENCIES :
+ ACE_OS::fprintf (file, "CYCLE_IN_DEPENDENCIES");
+ break;
+ case UNABLE_TO_OPEN_SCHEDULE_FILE :
+ ACE_OS::fprintf (file, "UNABLE_TO_OPEN_SCHEDULE_FILE");
+ break;
+ case UNABLE_TO_WRITE_SCHEDULE_FILE :
+ ACE_OS::fprintf (file, "UNABLE_TO_WRITE_SCHEDULE_FILE");
+ break;
+ // End of config-only status values.
+
+ default:
+ ACE_OS::fprintf (file, "UNKNOWN STATUS: %d", status);
+ }
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// class ACE_Scheduler member functions
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+ACE_Scheduler::ACE_Scheduler () :
+ minimum_priority_queue_ (0), // Could initialize this to -1, but it's
+ // unsigned and we don't really need to
+ // distinguish between no queues and one
+ // queue.
+ modes_ (0),
+ tasks_ (0),
+ threads_ (0),
+ mode_ (0),
+ status_ (NOT_SCHEDULED),
+ output_level_ (0)
+{
+}
+
+
+ACE_Scheduler::~ACE_Scheduler ()
+{
+}
+
+
+// ************************************************************
+
+ACE_Scheduler::status_t
+ACE_Scheduler::get_rt_info (Object_Name name,
+ RT_Info* &rtinfo)
+{
+ handle_t handle;
+
+ // This makes a copy. We can optimize this with our own string
+ // class.
+ ACE_CString lookup (name);
+ // Search the map for the <name>. If found, return the RT_Info.
+ RT_Info **info_array = 0;
+ if (info_collection_.find (lookup, info_array) >= 0)
+ {
+ rtinfo = info_array[0];
+ // If we find it, return.
+ return SUCCEEDED;
+ }
+ else
+ // Otherwise, make one, bind it, and register it.
+ {
+ rtinfo = new RT_Info;
+ rtinfo->entry_point = name;
+ // Create and array (size one) of RT_Info*
+ info_array = new RT_Info*[1];
+ info_array[0] = rtinfo;
+ // Bind the rtinfo to the name.
+ if (info_collection_.bind (lookup, info_array) != 0)
+ {
+ delete rtinfo;
+ delete info_array;
+ rtinfo = 0;
+ return FAILED; // Error!
+ }
+ else
+ {
+ // Register the array.
+ status_t result = this->register_task (info_array, 1, handle);
+ if (result == SUCCEEDED)
+ {
+ rtinfo->handle = handle;
+ return ST_UNKNOWN_TASK; // Didn't find it, but made one!
+ }
+ else
+ {
+ rtinfo->handle = 0;
+ return FAILED;
+ }
+ }
+ }
+}
+
+
+
+int ACE_Scheduler::number_of_dependencies(RT_Info* rt_info)
+{
+ return rt_info->dependencies.length();
+}
+
+int ACE_Scheduler::number_of_dependencies(RT_Info& rt_info)
+{
+ return rt_info.dependencies.length();
+}
+
+int ACE_Scheduler::add_dependency(RT_Info* rt_info,
+ const Dependency_Info& d)
+{
+ ACE_DEBUG ((LM_DEBUG, "adding dependecy to: %s\n",
+ (const char*)rt_info->entry_point));
+ RtecScheduler::Dependency_Set& set = rt_info->dependencies;
+ int l = set.length();
+ set.length(l + 1);
+ set[l] = d;
+ return 0;
+}
+
+void ACE_Scheduler::export(RT_Info* info, FILE* file)
+{
+ export(*info, file);
+}
+
+void ACE_Scheduler::export(RT_Info& info, FILE* file)
+{
+ // The divide-by-1 is for ACE_U_LongLong support.
+ (void) ACE_OS::fprintf (file,
+ "%s\n%d\n%ld\n%ld\n%ld\n%ld\n%d\n%ld\n%u\n"
+ "# begin dependencies\n%d\n",
+ (const char*)info.entry_point,
+ info.handle,
+ info.worst_case_execution_time / 1,
+ info.typical_execution_time / 1,
+ info.cached_execution_time / 1,
+ info.period,
+ info.importance,
+ info.quantum / 1,
+ info.threads,
+ number_of_dependencies(info));
+
+ for (u_int i = 0; i < number_of_dependencies(info); ++i)
+ {
+ RT_Info tmp;
+ // TODO: info.dependencies [i].rt_info >>= &tmp;
+ (void) ACE_OS::fprintf (file, "%s, %d\n",
+ (const char*)tmp.entry_point,
+ info.dependencies[i].number_of_calls);
+
+ }
+
+ (void) ACE_OS::fprintf (file, "# end dependencies\n%d\n%d\n\n",
+ info.priority,
+ info.subpriority);
+
+
+}
+
+
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Lock_Adapter<ACE_Null_Mutex>;
+template class ACE_Map_Entry<ACE_CString, ACE_Scheduler::RT_Info **>;
+
+#if defined (ACE_HAS_THREADS)
+ template class ACE_Lock_Adapter<ACE_RW_Thread_Mutex>;
+ template class ACE_Lock_Adapter<ACE_Thread_Mutex>;
+ template class ACE_Map_Manager<ACE_CString,
+ ACE_Scheduler::RT_Info **,
+ ACE_Thread_Mutex>;
+ template class ACE_Map_Iterator<ACE_CString, ACE_Scheduler::RT_Info **,
+ ACE_Thread_Mutex>;
+ template class ACE_Read_Guard<ACE_Thread_Mutex>;
+ template class ACE_Write_Guard<ACE_Thread_Mutex>;
+#else
+ template class ACE_Map_Manager<ACE_CString, RT_Info **,
+ ACE_Null_Mutex>;
+ template class ACE_Map_Iterator<ACE_CString, RT_Info **,
+ ACE_Null_Mutex>;
+ template class ACE_Read_Guard<ACE_Null_Mutex>;
+ template class ACE_Write_Guard<ACE_Null_Mutex>;
+#endif /* ACE_HAS_THREADS */
+#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate class ACE_Lock_Adapter<ACE_Null_Mutex>
+#pragma instantiate class ACE_Map_Entry<ACE_CString, RT_Info **>
+#pragma instantiate class ACE_Singleton<ACE_Scheduler::TaskManager>
+
+#if defined (ACE_HAS_THREADS)
+#pragma instantiate class ACE_Lock_Adapter<ACE_RW_Thread_Mutex>
+#pragma instantiate class ACE_Lock_Adapter<ACE_Thread_Mutex>
+#pragma instantiate class ACE_Map_Manager<ACE_CString, RT_Info **, ACE_Thread_Mutex>
+#pragma instantiate class ACE_Map_Iterator<ACE_CString, RT_Info **, ACE_Thread_Mutex>
+#pragma instantiate class ACE_Read_Guard<ACE_Thread_Mutex>
+#pragma instantiate class ACE_Write_Guard<ACE_Thread_Mutex>
+#else
+#pragma instantiate class ACE_Map_Manager<ACE_CString, RT_Info **, ACE_Null_Mutex>
+#pragma instantiate class ACE_Map_Iterator<ACE_CString, RT_Info **, ACE_Null_Mutex>
+#pragma instantiate class ACE_Read_Guard<ACE_Null_Mutex>
+#pragma instantiate class ACE_Write_Guard<ACE_Null_Mutex>
+#endif /* ACE_HAS_THREADS */
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
+// EOF
diff --git a/TAO/local/bin/Scheduling_Service/Scheduler.h b/TAO/local/bin/Scheduling_Service/Scheduler.h
new file mode 100644
index 00000000000..c24d9f91f44
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Scheduler.h
@@ -0,0 +1,278 @@
+/* -*- C++ -*- */
+//
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// sched
+//
+// = FILENAME
+// Scheduler.h
+//
+// = CREATION DATE
+// 23 January 1997
+//
+// = AUTHOR
+// David Levine
+//
+// ============================================================================
+
+#if ! defined (SCHEDULER_H)
+#define SCHEDULER_H
+
+#include "ace/ACE.h"
+#include "ace/Map_Manager.h"
+#include "ace/Message_Block.h"
+#include "ace/Synch.h"
+#include "ace/SString.h"
+
+#include "RtecSchedulerC.h"
+#include "Event_Service_Constants.h"
+
+class ACE_Scheduler
+ // = TITLE
+ // Thread scheduler interface.
+ //
+ // = DESCRIPTION
+ // This virtual base class is the interface to either an off-line
+ // scheduler, or to the necessary on-line component of the Scheduler.
+{
+public:
+ typedef u_int mode_t;
+
+ typedef RtecScheduler::handle_t handle_t;
+ typedef RtecScheduler::Dependency_Info Dependency_Info;
+ typedef RtecScheduler::Preemption_Priority Preemption_Priority;
+ typedef RtecScheduler::OS_Priority OS_Thread_Priority;
+ typedef RtecScheduler::Sub_Priority Sub_Priority;
+ typedef RtecScheduler::RT_Info RT_Info;
+ // Map some types to simplify re-use.
+
+ typedef const char *Object_Name;
+ // Objects are named by unique strings.
+
+ static const mode_t CURRENT_MODE;
+
+ enum status_t {
+ // The following are used both by the runtime Scheduler and during
+ // scheduling.
+ NOT_SCHEDULED = -1 // the schedule () method has not been called yet
+ , FAILED = -1
+ , SUCCEEDED
+ , ST_UNKNOWN_TASK
+ , ST_TASK_ALREADY_REGISTERED
+ , ST_VIRTUAL_MEMORY_EXHAUSTED
+
+ // The following are only used by the runtime Scheduler.
+ , INVALID_MODE
+ , MODE_COUNT_MISMATCH // only used by schedule ()
+ , TASK_COUNT_MISMATCH // only used by schedule ()
+ , INVALID_PRIORITY // only used by schedule (): mismatch of
+ // (off-line, maybe) Scheduler output to
+ // the runtime Scheduler component.
+
+ // The following are only used during scheduling (in the case of
+ // off-line scheduling, they are only used prior to runtime).
+ , ST_UTILIZATION_BOUND_EXCEEDED
+ , ST_INSUFFICIENT_THREAD_PRIORITY_LEVELS
+ , ST_CYCLE_IN_DEPENDENCIES
+ , UNABLE_TO_OPEN_SCHEDULE_FILE
+ , UNABLE_TO_WRITE_SCHEDULE_FILE
+ };
+
+ virtual ~ACE_Scheduler ();
+
+ // = Utility function for outputting the textual representation of a
+ // status_t value to a FILE.
+ static void output (FILE *, const status_t);
+
+ // = Initialize the scheduler.
+ virtual void init (const int minimum_priority,
+ const int maximum_priority,
+ const char *runtime_filename = 0,
+ const char *rt_info_filename = 0,
+ const char *timeline_filename = 0) = 0;
+ // The minimum and maximum priority are the OS-specific priorities that
+ // are used when creating the schedule (assigning priorities). The
+ // minimum_priority is the priority value of the lowest priority.
+ // It may be numerically higher than the maximum_priority, on OS's such
+ // as VxWorks that use lower values to indicate higher priorities.
+ //
+ // When Scheduler::schedule is called, the schedule is output to the
+ // file named by "runtime_filename" if it is non-zero.
+ // This file is compilable; it is linked into the runtime executable
+ // to provide priorities to the runtime scheduling component.
+ // If the "rt_info_filename" is non-zero, the RT_Info for
+ // every task is exported to it. It is not used at runtime.
+ // If the "timeline_filename" is non-zero, the timeline output
+ // file is created. It is not used at runtime.
+ //
+ // The runtime scheduling component ignores these filenames. It just
+ // uses the priorities that were linked in to the executable, after
+ // converting them to platform-specific values.
+
+ // = Registers a task.
+ virtual status_t register_task (RT_Info *[],
+ const u_int number_of_modes,
+ handle_t &handle) = 0;
+ // If the Task registration succeeds, this function returns SUCCEEDED
+ // and sets "handle" to a unique identifier for the task.
+ // Otherwise, it returns either VIRTUAL_MEMORY_EXHAUSTED or
+ // TASK_ALREADY_REGISTERED sets the handle to 0. (A task may
+ // only be registered once.)
+ // The RT_Info * array is indexed by mode; there must be one element for
+ // each mode, as specified by number_of_modes. If a task does not
+ // run in a mode, then its entry in the array for that mode must
+ // be 0.
+
+ virtual status_t get_rt_info (Object_Name name,
+ RT_Info* &rtinfo);
+ // Tries to find the RT_Info corresponding to <name> in the RT_Info
+ // database. Returns SUCCEEDED if <name> was found and <rtinfo> was
+ // set. Returns UNKNOWN_TASK if <name> was not found, but <rtinfo>
+ // was set to a newly allocated RT_Info. In this UNKNOWN_TASK case,
+ // the task must call RT_Info::set to fill in execution properties.
+ // In the SUCCEEDED and UNKNOWN_TASK cases, this->register_task
+ // (rtinfo, 0, handle) is called. Returns FAILED if an error
+ // occurs.
+ //
+ // One motivation for allocating RT_Info's from within the Scheduler
+ // is to allow RT_Infos to persist after the tasks that use them.
+ // For instance, we may want to call this->schedule right before the
+ // application exits a configuration run. If the tasks have been
+ // deleted (deleting their RT_Infos with them), this->schedule will
+ // fail.
+
+ virtual status_t lookup_rt_info (handle_t handle,
+ RT_Info* &rtinfo) = 0;
+ // Obtains an RT_Info based on its "handle".
+
+ // = Computes the schedule.
+ virtual status_t schedule (void) = 0;
+ // This actually generates the files.
+
+ // = Access a thread priority.
+ virtual int priority (const handle_t handle,
+ OS_Thread_Priority &priority,
+ Sub_Priority &subpriority,
+ Preemption_Priority &preemption_prio,
+ const mode_t = CURRENT_MODE) const = 0;
+ // Defines "priority" as the priority that was assigned to the Task that
+ // was assigned "handle", for the specified mode. Defines "subpriority"
+ // as the relative ordering (due to dependencies) within the priority.
+ // Returns 0 on success, or -1 if an invalid mode or handle are supplied.
+ // Queue numbers are platform-independent priority values, ranging from
+ // a highest priority value of 0 to the lowest priority value, which is
+ // returned by "minimum_priority_queue ()".
+
+ // = Access the platform-independent priority value of the lowest-priority
+ // thread.
+ u_int minimum_priority_queue () const { return minimum_priority_queue_; }
+ // This is intended for use by the Event Channel, so it can determine the
+ // number of priority dispatch queues to create.
+
+ // = Access the number of modes.
+ u_int modes () const { return modes_; }
+
+ // = Access the number of tasks.
+ u_int tasks () const { return tasks_; }
+
+ // = Access the number of threads.
+ u_int threads () const { return threads_; }
+
+ // = Access the current mode.
+ mode_t mode () const { return mode_; }
+
+ // = Set the current mode.
+ void mode (const mode_t mode) { mode_ = mode; }
+
+ // = Access the current scheduler status.
+ status_t status () const { return status_; }
+
+ // = Access the current output (debugging) level.
+ u_int output_level () const { return output_level_; }
+ // Default is 0; set to 1 to print out schedule, by task. Set
+ // to higher than one for debugging info.
+
+ // = Set the scheduler output (debugging) level.
+ void output_level (const u_int level) { output_level_ = level; }
+ // the only supported levels are 0 (quiet), 1 (verbose) and 2
+ // (debug)
+
+ static int add_dependency(RT_Info* rt_info,
+ const Dependency_Info& d);
+
+ static int number_of_dependencies(RT_Info* rt_info);
+ static int number_of_dependencies(RT_Info& rt_info);
+
+ static void export(RT_Info*, FILE* file);
+ static void export(RT_Info&, FILE* file);
+
+protected:
+ ACE_Scheduler ();
+
+ // = Set the minimum priority value.
+ void minimum_priority_queue (const u_int minimum_priority_queue_number)
+ { minimum_priority_queue_ = minimum_priority_queue_number; }
+
+ // = Set the number of modes.
+ void modes (const u_int modes) { modes_ = modes; }
+
+ // = Set the number of tasks.
+ void tasks (const u_int tasks) { tasks_ = tasks; }
+
+ // = Set the number of threads.
+ void threads (const u_int threads) { threads_ = threads; }
+
+ // = Set the current scheduler status.
+ void status (const status_t new_status) { status_ = new_status; }
+
+private:
+ typedef ACE_CString EXT;
+ typedef RT_Info **INT;
+
+#if defined (ACE_HAS_THREADS)
+ typedef ACE_Thread_Mutex SYNCH;
+#else
+ typedef ACE_Null_Mutex SYNCH;
+#endif /* ACE_HAS_THREADS */
+
+ typedef ACE_Map_Manager<EXT, INT, SYNCH> Info_Collection;
+ typedef ACE_Map_Iterator<EXT, INT, SYNCH> Info_Collection_Iterator;
+ typedef ACE_Map_Entry<EXT, INT> Info_Collection_Entry;
+
+ Info_Collection info_collection_;
+ // A binding of name to rt_info. This is the mapping for every
+ // rt_info in the process.
+
+ static ACE_Scheduler *instance_;
+
+ u_int minimum_priority_queue_;
+ // The platform-independent priority value of the Event Channel's
+ // minimum priority dispatch queue. The value of the maximum priority
+ // dispatch queue is always 0.
+
+ u_int modes_;
+ u_int tasks_;
+ u_int threads_;
+
+ mode_t mode_;
+ status_t status_;
+ u_int output_level_;
+
+ // the following functions are not implememented
+ ACE_UNIMPLEMENTED_FUNC(ACE_Scheduler (const ACE_Scheduler &))
+ ACE_UNIMPLEMENTED_FUNC(ACE_Scheduler &operator= (const ACE_Scheduler &))
+};
+
+typedef ACE_Scheduler Scheduler;
+
+#if defined (__ACE_INLINE__)
+#include "Scheduler.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* SCHEDULER_H */
+
+
+// EOF
diff --git a/TAO/local/bin/Scheduling_Service/Scheduler.i b/TAO/local/bin/Scheduling_Service/Scheduler.i
new file mode 100644
index 00000000000..57875ae26d1
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Scheduler.i
@@ -0,0 +1,20 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// sched
+//
+// = FILENAME
+// Scheduler.i
+//
+// = CREATION DATE
+// 23 January 1997
+//
+// = AUTHOR
+// David Levine
+//
+// ============================================================================
+
+// EOF
+
diff --git a/TAO/local/bin/Scheduling_Service/Scheduler_Internal.cpp b/TAO/local/bin/Scheduling_Service/Scheduler_Internal.cpp
new file mode 100644
index 00000000000..e112ab50c9f
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Scheduler_Internal.cpp
@@ -0,0 +1,2332 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// sched
+//
+// = FILENAME
+// Scheduler_Internal.cpp
+//
+// = CREATION DATE
+// 23 January 1997
+//
+// = AUTHOR
+// David Levine
+//
+// ============================================================================
+
+#include "math.h" // for ::pow ()
+#include "float.h" // for DBL_EPSILON
+
+#include "ace/Sched_Params.h"
+
+#include "Scheduler_Internal.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "Scheduler_Internal.i"
+#endif /* __ACE_INLINE__ */
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// static functions
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+// Structure for storing the RT_Info information for each task, per mode.
+struct Mode_Entry
+{
+ RtecScheduler::RT_Info *rt_info_;
+ u_long start_time_; // microseconds
+ u_long stop_time_; // microseconds
+
+ Mode_Entry() :
+ rt_info_ (0),
+ start_time_ (0),
+ stop_time_ (0)
+ {
+ }
+
+ Mode_Entry(RtecScheduler::RT_Info *const rt_info,
+ const u_long start_time = 0,
+ const u_long stop_time = 0) :
+ rt_info_ (rt_info),
+ start_time_ (start_time),
+ stop_time_ (stop_time)
+ {
+ }
+
+ ~Mode_Entry () {}
+
+ Mode_Entry &operator= (const Mode_Entry &entry)
+ {
+ if (this != &entry)
+ {
+ rt_info_ = entry.rt_info_;
+ start_time_ = entry.start_time_;
+ stop_time_ = entry.stop_time_;
+ }
+
+ return *this;
+ }
+};
+
+
+// "Add" an RT_Info to another.
+static RtecScheduler::RT_Info&
+operator+= (RtecScheduler::RT_Info *rt_info1,
+ const RtecScheduler::RT_Info &rt_info2)
+{
+ rt_info1->worst_case_execution_time = (rt_info1->worst_case_execution_time
+ + rt_info2.worst_case_execution_time);
+ rt_info1->typical_execution_time = (rt_info1->typical_execution_time
+ + rt_info2.typical_execution_time);
+ rt_info1->cached_execution_time = (rt_info1->cached_execution_time
+ + rt_info2.cached_execution_time);
+
+ if ((rt_info1->period > rt_info2.period && rt_info2.period > 0)
+ || rt_info1->period <= 0)
+ {
+ rt_info1->period = rt_info2.period;
+ }
+
+ return *rt_info1;
+}
+
+
+// Sort the threads into the sorted_rt_info array,
+// by decreasing (non-increasing, actually) period.
+// Returns the number of tasks in the input set.
+static
+void
+sort (Scheduler_Internal::Thread_Map &threads,
+ u_long number_of_threads,
+ Mode_Entry sorted_rt_info [],
+ u_int output_level)
+{
+ u_int tasks = 0;
+
+ ACE_OS::memset (sorted_rt_info, 0, (size_t) number_of_threads);
+
+ // Iterate over each of the RT_Info entries that we know about,
+ // sorting the entries by decreasing (non-increasing) period.
+ Scheduler_Internal::Thread_Map_Entry *entry;
+ Scheduler_Internal::Thread_Map_Iterator i (threads);
+ while (i.next (entry))
+ {
+ i.advance ();
+ RtecScheduler::RT_Info &rt_info = *entry->int_id_;
+ const RtecScheduler::Time entry_time = rt_info.worst_case_execution_time;
+ const RtecScheduler::Period entry_period = rt_info.period;
+
+ if (output_level >= 1)
+ {
+ ACE_OS::printf ("Thread \"%s\"; utilization is %g and period is %ld"
+ " usec (%g Hz)\n",
+ (const char*)rt_info.entry_point,
+ entry_period > 0
+#if defined (ACE_WIN32) || defined (ACE_HAS_LONGLONG_T)
+ ? (double) entry_time / entry_period
+#else
+ ? (double) entry_time.lo () / entry_period
+#endif /* ACE_WIN32 || ACE_HAS_LONGLONG_T */
+ : 0,
+ entry_period / 10 /* usec/100 ns */,
+ entry_period > 0
+ ? 1.0e7 /* 1/100 ns */ / entry_period
+ : 0.0);
+ }
+
+ // Use selection sort to sort entries by period. It's O (n^2), but n
+ // shouldn't be very big.
+ u_int j;
+ for (j = 0; j < tasks; ++j)
+ {
+ if (entry_period > sorted_rt_info [j].rt_info_->period)
+ {
+ // Found a smaller period: since we are sorting by decreasing
+ // period, need to insert the current period here.
+
+ if (output_level >= 2)
+ {
+ ACE_OS::printf ("insert task before task %u with period %ld\n",
+ j + 1,
+ sorted_rt_info [j].rt_info_->period /
+ 10 /* usec/100 ns */);
+ }
+
+ // insert this entry into the sort list here
+ for (u_int k = tasks; k > j; --k)
+ {
+ sorted_rt_info [k] = sorted_rt_info [k - 1];
+ }
+ sorted_rt_info [j].rt_info_ = &rt_info;
+
+ break;
+ }
+ }
+ if (j >= tasks)
+ {
+ // The entry does not have a lower period than any that we've
+ // already seen, so append it to the end of the sorted RT_Info array.
+ if (output_level >= 2)
+ {
+ ACE_OS::printf ("insert task with period %ld at end of sorted "
+ "array\n",
+ entry_period / 10 /* usec/100 ns */);
+ }
+ sorted_rt_info [j].rt_info_ = &rt_info;
+ }
+
+ ++tasks;
+ }
+}
+
+
+// Check for harmonically related periods by comparing this entry's period
+// with that of each of the other entries for integral division.
+// As a side effect, figures out the frame_size, in microsec.
+static
+int
+harmonically_related_periods (Mode_Entry const sorted_rt_info [],
+ const u_int number_of_tasks,
+ u_long &frame_size)
+{
+ int harmonically_related = 1;
+ u_int i;
+
+ if (number_of_tasks > 0)
+ {
+ // start frame_size with the longest period
+
+ for (i = 0; i < number_of_tasks; ++i)
+ frame_size = (u_long) (sorted_rt_info [0].rt_info_->period /
+ 10 /* microsec/100 ns */);
+ }
+
+ for (i = 0; i < number_of_tasks - 1; ++i)
+ {
+ // Skip over groups of array entries with the same period.
+ while (i > 0 && i < number_of_tasks - 1 &&
+ sorted_rt_info [i].rt_info_->period ==
+ sorted_rt_info [i - 1].rt_info_->period)
+ {
+ ++i;
+ }
+
+ // Compare the current RT_Info entry, at location i in the
+ // sorted array, to each of the remoining (with higher array index)
+ // entries.
+ for (u_int j = i + 1; j < number_of_tasks; ++j)
+ {
+ // if the period is 0, skip the task
+ if (sorted_rt_info [j].rt_info_->period <= 0)
+ break;
+
+ // Assumes that the sorted_rt_info array is in decreasing
+ // (non-increasing) order.
+ double quotient = (double) sorted_rt_info [i].rt_info_->period /
+ sorted_rt_info [j].rt_info_->period;
+
+ if (quotient - (long) quotient > DBL_EPSILON)
+ {
+ harmonically_related = 0;
+
+ // and add another factor to the frame_size
+ frame_size *= (u_long) (sorted_rt_info [i].rt_info_->period /
+ 10 /* microseconds/100 ns */);
+ }
+ }
+ }
+
+ return harmonically_related;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// class Scheduler_Internal member functions
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+Scheduler_Internal::Scheduler_Internal () :
+ Scheduler (),
+ handles_ (0),
+ // Set the minimum priority to that for the current platform. This
+ // shouldn't be necessary, but UPSingleProcessorOrb::initialize_reactors
+ // creates threads before the Event Channel calls Scheduler::init ().
+ minimum_priority_ (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
+ ACE_SCOPE_THREAD)),
+ increasing_priority_ (-1),
+ task_entries_ (),
+ ordered_info_ (0),
+ visited_ (0),
+ dependencies_ (0),
+ roots_ (0),
+ frame_size_ (0),
+ thread_info_ (0),
+ leaf_info_ (0),
+ timeline_ (0)
+{
+}
+
+
+Scheduler_Internal::~Scheduler_Internal ()
+{
+ reset ();
+
+ delete [] timeline_;
+ timeline_ = 0;
+
+ for (u_int current_mode = 0; current_mode < modes (); ++current_mode)
+ {
+ // Iterate over each of the thread_info_ entries and delete them.
+ Thread_Map_Entry *entry;
+ Thread_Map_Iterator i (thread_info_ [current_mode]);
+ while (i.next (entry))
+ {
+ i.advance ();
+ thread_info_ [current_mode].unbind (entry->ext_id_);
+ delete entry->int_id_;
+ }
+ }
+
+ for (u_int task = 0; task < tasks (); ++task)
+ {
+ delete [] ordered_info_ [task];
+ }
+
+ delete [] thread_info_;
+ thread_info_ = 0;
+
+ delete [] ordered_info_;
+ ordered_info_ = 0;
+
+ delete [] frame_size_;
+ frame_size_ = 0;
+}
+
+
+void
+Scheduler_Internal::reset ()
+{
+ delete dependencies_;
+ dependencies_ = 0;
+
+ delete roots_;
+ roots_ = 0;
+
+ delete leaf_info_;
+ leaf_info_ = 0;
+}
+
+Scheduler::status_t
+Scheduler_Internal::lookup_rt_info (handle_t handle,
+ RT_Info*& rtinfo)
+{
+ if (handle < 0 || handle > task_entries_.size ())
+ {
+ return ST_UNKNOWN_TASK;
+ }
+ RT_Info*** entry;
+ ACE_Unbounded_Set_Iterator <RT_Info **> i (task_entries_);
+ while (i.next (entry) != 0)
+ {
+ i.advance ();
+ RT_Info** array = *entry;
+ if (array[0]->handle == handle)
+ {
+ rtinfo = array[0];
+ return SUCCEEDED;
+ }
+ }
+
+ return ST_UNKNOWN_TASK;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::register_task (RT_Info *rt_info [],
+ const u_int number_of_modes,
+ handle_t &handle)
+{
+ status_t ret;
+
+ // try to store the new task's information . . .
+ switch (task_entries_.insert (rt_info))
+ {
+ case 0 : // successfully inserted
+ {
+ rt_info [0]->handle = (handle = ++handles_);
+
+ // assigned the same handle to the RT_Info for each of its modes
+ for (u_int i = 1; i < number_of_modes; ++i)
+ {
+ if (rt_info [i] != 0)
+ rt_info [i]->handle = handle;
+ }
+
+ if (number_of_modes > modes ())
+ {
+ modes (number_of_modes);
+ }
+
+ ret = SUCCEEDED;
+
+ if (output_level () >= 5)
+ {
+ ACE_OS::printf ("registered task \"%s\" with RT_Info starting "
+ "at %X\n",
+ (const char*)rt_info[0]->entry_point,
+ (void *) rt_info[0]);
+ }
+ }
+ break;
+
+ case 1 : // the entry had already been inserted
+ handle = 0;
+ ret = ST_TASK_ALREADY_REGISTERED;
+ break;
+
+ default :
+ // case -1 : insert failed, probably because virtual memory exhaused
+ handle = 0;
+ ret = ST_VIRTUAL_MEMORY_EXHAUSTED;
+ break;
+ }
+
+ return ret;
+}
+
+
+void
+Scheduler_Internal::init (const int minimum_priority,
+ const int maximum_priority,
+ const char *runtime_filename,
+ const char *rt_info_filename,
+ const char *timeline_filename)
+{
+ minimum_priority_ = minimum_priority;
+ maximum_priority_ = maximum_priority;
+ runtime_filename_ = runtime_filename;
+ rt_info_filename_ = rt_info_filename;
+ timeline_filename_ = timeline_filename;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::schedule (void)
+{
+ ACE_Guard<LOCK> ace_mon (lock_);
+
+ // here goes . . .
+
+ increasing_priority_ = maximum_priority_ >= minimum_priority_;
+
+ status_t status = NOT_SCHEDULED;
+
+ // store number of tasks, based on registrations
+ tasks (task_entries_.size ());
+
+ // allocate tables . . .
+ ACE_NEW_RETURN (ordered_info_, RT_Info **[tasks ()],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ for (u_int task = 0; task < tasks (); ++task)
+ {
+ ACE_NEW_RETURN (ordered_info_ [task], RT_Info *[modes ()],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ ACE_OS::memset (ordered_info_ [task], 0,
+ sizeof (RT_Info *) * modes ());
+ }
+
+ ACE_NEW_RETURN (thread_info_, Thread_Map [modes ()],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ ACE_NEW_RETURN (frame_size_, u_long [modes ()],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ // set up timeline structure
+ if (timeline_filename_ != 0)
+ {
+ ACE_NEW_RETURN (timeline_,
+ ACE_Unbounded_Queue <Timeline_Entry> [modes()],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ }
+
+ for (u_int current_mode = 0; current_mode < modes (); ++current_mode)
+ {
+ // set the current mode
+ mode (current_mode);
+
+ status_t mode_status = NOT_SCHEDULED;
+
+ // Identify threads and store information in convenient form for later
+ // use.
+ if ((mode_status = identify_threads ()) != SUCCEEDED)
+ {
+ return mode_status; // should only happen if virtual memory exceeded
+ }
+
+ // Traverse task dependencies to aggregate thread parameters.
+ if ((mode_status = aggregate_thread_parameters ()) != SUCCEEDED)
+ {
+ return mode_status; // should only happen if virtual memory exceeded
+ }
+
+ // only RMS is currently supported
+ if ((mode_status = schedule_rms (minimum_priority_,
+ maximum_priority_)) == SUCCEEDED)
+ {
+ if (status == NOT_SCHEDULED) status = SUCCEEDED;
+ }
+ else
+ {
+ status = mode_status;
+ }
+ }
+
+ if (output_level () > 0)
+ {
+ print_schedule ();
+ }
+
+ if (runtime_filename_ != 0 &&
+ (status == SUCCEEDED || status == ST_UTILIZATION_BOUND_EXCEEDED))
+ {
+ status = store_schedule (runtime_filename_);
+ }
+
+ if (timeline_filename_ != 0 &&
+ (status == SUCCEEDED || status == ST_UTILIZATION_BOUND_EXCEEDED))
+ {
+ status = create_timelines (timeline_filename_);
+ }
+
+ if ((status == SUCCEEDED || status == ST_UTILIZATION_BOUND_EXCEEDED) && rt_info_filename_)
+ {
+ status = store_rt_info (rt_info_filename_);
+ }
+
+ // If there was a failure, (try to) remove the output files.
+ if (! (status == SUCCEEDED || status == ST_UTILIZATION_BOUND_EXCEEDED))
+ {
+ if (runtime_filename_ && unlink ((char *) runtime_filename_)
+ && errno != ENOENT)
+ {
+ ACE_OS::perror ("Scheduler_Internal::schedule (); "
+ "unable to remove schedule file");
+ }
+ if (rt_info_filename_ && unlink ((char *) rt_info_filename_) &&
+ errno != ENOENT)
+ {
+ ACE_OS::perror ("Scheduler_Internal::schedule (); "
+ "unable to remove rt_info file");
+ }
+ }
+
+ return status;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::update_dependencies (RT_Info &rt_info,
+ Sub_Priority subpriority)
+{
+ u_int i = 0;
+
+ // Detect cycles in the dependency graph by storing (the address of)
+ // each RT_Info instance as it is visited. Then, on every visit,
+ // check to see if the instance had already been visited. Flag it,
+ // if so (and stop the recursion :-).
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies; visiting \"%s\"",
+ (const char*)rt_info.entry_point);
+ }
+
+ switch (visited_->insert (&rt_info))
+ {
+ case -1 :
+ return ST_VIRTUAL_MEMORY_EXHAUSTED;
+ case 0 :
+ // successfully inserted
+ break;
+ case 1 :
+ default :
+ // oops, had already visited this rt_info!
+#if 0 /* Ignore, it seems to work well without this check */
+ return CYCLE_IN_DEPENDENCIES;
+#else
+ break;
+#endif /* 0 */
+ }
+
+ Scheduler::status_t ret = NOT_SCHEDULED;
+
+ if (rt_info.priority == -1)
+ {
+ // Just updating the subpriority.
+
+ int *ordered_deps = 0;
+ int *marked = 0;
+
+ // Sort the dependencies by importance, lowest first.
+ ACE_NEW_RETURN (ordered_deps, int [number_of_dependencies (rt_info)],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ ACE_NEW_RETURN (marked, int [number_of_dependencies (rt_info)],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ for (i = 0; i < number_of_dependencies (rt_info); ++i)
+ {
+ ordered_deps [i] = -1;
+ marked [i] = 0;
+ }
+
+ for (i = 0; i < number_of_dependencies (rt_info); ++i)
+ {
+ Sub_Priority current_importance = 0x7FFF;
+ int current_importance_dep = -1;
+
+ // Find the unmarked dependent with the lowest importances.
+ for (u_int j = 0; j < number_of_dependencies (rt_info); ++j)
+ {
+ ACE_ASSERT (rt_info.dependencies[j].rt_info != -1);
+ RT_Info* info;
+ this->lookup_rt_info (rt_info.handle, info);
+ if (! marked [j] &&
+ info->importance <= current_importance)
+ {
+ current_importance = info->importance;
+ current_importance_dep = j;
+ }
+ }
+
+ ACE_ASSERT (current_importance_dep != -1);
+ ordered_deps [i] = current_importance_dep;
+ marked [current_importance_dep] = 1;
+ }
+
+ if (output_level () >= 5)
+ {
+ ACE_OS::printf ("\"%s\" has %d dependencies\n",
+ (const char*)rt_info.entry_point,
+ number_of_dependencies(rt_info));
+ for (i = 0; i < number_of_dependencies(rt_info); ++i)
+ {
+ RT_Info* info;
+ this->lookup_rt_info (rt_info.dependencies[ordered_deps[i]].rt_info, info);
+ ACE_OS::printf ("ordered dependency %d: \"%s\" (importance: %d)\n",
+ i,
+ (const char*)info->entry_point,
+ info->importance);
+ }
+ }
+
+ // Traverse the dependent tasks, in order of importance.
+ for (i = 0; i < number_of_dependencies (rt_info); ++i)
+ {
+ RT_Info* dep_info;
+ this->lookup_rt_info (rt_info.dependencies[ordered_deps[i]].rt_info,
+ dep_info);
+ if (i > 0)
+ {
+ RT_Info* previous_info;
+ this->lookup_rt_info (rt_info.dependencies[ordered_deps [i-1]].rt_info,
+ previous_info);
+ if (previous_info->importance < dep_info->importance)
+ {
+ // Increment subpriority based on increased importance
+ // of this dependent.
+ ++subpriority;
+ }
+ }
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies (); "
+ "incremented subpriority to %u\n",
+ subpriority);
+ }
+
+ dep_info->subpriority = subpriority;
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies (); "
+ "set subpriority of \"%s\"o %u\n",
+ (const char*)dep_info->entry_point,
+ subpriority);
+ }
+
+ // Recurse until all dependent tasks have been visited.
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies (); "
+ "calling recursively for dependent \"%s\"\n",
+ (const char*)dep_info->entry_point);
+ }
+
+ if ((ret = update_dependencies (*dep_info,
+ subpriority + 1)) != NOT_SCHEDULED)
+ {
+ break;
+ }
+ }
+
+ delete [] ordered_deps;
+ delete [] marked;
+ }
+ else
+ {
+ for (i = 0; i < number_of_dependencies (rt_info); ++i)
+ {
+ RT_Info* info;
+ this->lookup_rt_info (rt_info.dependencies[i].rt_info, info);
+ info->priority = rt_info.priority;
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies (); "
+ "set priority of \"%s\" to %d "
+ "(its subpriority is %u)\n",
+ (const char*)info->entry_point,
+ info->priority,
+ info->subpriority);
+ }
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies (); "
+ "calling recursively for dependent \"%s\"\n",
+ (const char*)info->entry_point);
+ }
+
+ // Recurse until all dependent tasks have been visited.
+ if ((ret = update_dependencies (*info,
+ 0 /* not used when
+ setting priorities */)) !=
+ NOT_SCHEDULED)
+ {
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::schedule_rms (const int minimum_priority,
+ const int maximum_priority)
+{
+ double utilization = 0.0;
+ u_int i;
+
+ // Allocate an array for the sorted RT_Info.
+ Mode_Entry *sorted_rt_info;
+ ACE_NEW_RETURN (sorted_rt_info, Mode_Entry [threads ()],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ // Sort the threads' thread info entries by period.
+ sort (thread_info_ [mode ()], threads (), sorted_rt_info, output_level ());
+
+ // Load priorities by walking the sorted rt_info_array, incrementing
+ // current_priority for each new period (rate). For threads af the same
+ // rate, assign subpriorities based on 1) data dependencies and
+ // 2) importance. Also, calculate CPU utilization on the fly.
+ ACE_Sched_Priority current_priority = minimum_priority;
+ for (i = 0; i < threads (); ++i)
+ {
+ RT_Info &rt_info = *sorted_rt_info [i].rt_info_;
+ const RtecScheduler::Time entry_time = rt_info.worst_case_execution_time;
+ const RtecScheduler::Period entry_period = rt_info.period;
+
+ if (entry_period > DBL_EPSILON)
+ {
+#if defined (ACE_WIN32) || defined (ACE_HAS_LONGLONG_T)
+ utilization += (double) entry_time / entry_period;
+#else
+ utilization += (double) entry_time.lo () / entry_period;
+#endif /* ACE_WIN32 || ACE_HAS_LONGLONG_T */
+ }
+
+ if (i != 0 && output_level () >= 3)
+ {
+
+ ACE_OS::printf ("entry_period: %d (\"%s\"), "
+ "previous thread period: %d\n",
+ entry_period,
+ (const char*)sorted_rt_info [i].rt_info_->entry_point,
+ sorted_rt_info [i - 1].rt_info_->period);
+ }
+
+ // If i == 0, we're at the starting point: there are no other threads
+ // to compare to.
+ if (i != 0 && entry_period != sorted_rt_info [i - 1].rt_info_->period)
+ {
+ // If the period of this task is the same as the period of the
+ // previous task (the threads are sorted by period), then assign
+ // it the same ("current") priority. Otherwise, assign a higher
+ // priority (which may have a lower value), via "current_priority".
+ if (current_priority == maximum_priority)
+ {
+ status (ST_INSUFFICIENT_THREAD_PRIORITY_LEVELS);
+ }
+ else
+ {
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf ("will advance current_priority from its "
+ "current %d for period of %d\n",
+ current_priority, entry_period);
+ }
+
+ if (increasing_priority_)
+ {
+ // This assumes that the target and host are the
+ // same platform! It's hear to deal with the
+ // non-contiguous OS priorities of Win32 platforms.
+ current_priority =
+ ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
+ current_priority,
+ ACE_SCOPE_PROCESS);
+ }
+ else
+ {
+ // This assumes that the OS priorities on the target
+ // are contiguous, e.g., 255, 254, 253, 252, etc.,
+ // from low to high priority. The only target we
+ // use with decreasing priorities, VxWorks, does have
+ // contiguous OS priorities.
+ --current_priority;
+ }
+ }
+ }
+
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf ("thread %s, set priority to %d\n",
+ (const char*)rt_info.entry_point,
+ current_priority);
+ }
+
+ rt_info.priority = current_priority;
+
+ // There should only be one dependency for each
+ // RT_Info instance in the (sorted) thread_info_ array.
+ if (number_of_dependencies (rt_info) != 1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "On '%s' deps count should be 1, it is %d\n",
+ (const char*)rt_info.entry_point,
+ number_of_dependencies(rt_info)));
+ }
+
+ // . . . and it should have a valid RT_Info pointer.
+ ACE_ASSERT (rt_info.dependencies[0].rt_info != -1);
+ RT_Info* tmp;
+ this->lookup_rt_info (rt_info.dependencies[0].rt_info, tmp);
+ tmp->priority = current_priority;
+ }
+
+
+ // Set the priority of every task.
+ ACE_Bounded_Set_Iterator <RT_Info *> root_i (*roots_);
+ RT_Info **root;
+ while (root_i.next (root) != 0)
+ {
+ root_i.advance ();
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("ROOT: %s\n",
+ (const char*)(*root)->entry_point);
+ }
+
+ RT_Info *leaf = 0;
+ leaf_info_->find ((const char*)(*root)->entry_point, leaf);
+ ACE_ASSERT (leaf != 0);
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("found leaf_info entry %s\n",
+ (const char*)leaf->entry_point);
+ }
+
+ // Find the highest priority leaf corresponding to each root.
+ // ???? should do that!
+
+ (*root)->priority = leaf->priority;
+
+ // Update the priority of all dependent tasks.
+ // update_dependencies () is recursive, so set up the visited_
+ // structure outside of it.
+ ACE_NEW_RETURN (visited_,
+ ACE_Bounded_Set <const RT_Info *> (tasks ()),
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ if (status () == NOT_SCHEDULED /* first mode */ ||
+ status () == SUCCEEDED /* subsequent modes */ )
+ {
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies (); call for "
+ "root %s to set priorities\n",
+ (const char*)(*root)->entry_point);
+ }
+
+ status (update_dependencies (**root, 0 /* not used when
+ setting priorities */));
+ }
+
+ delete visited_;
+ visited_ = 0;
+ }
+
+ // Set minimum_priority, the priority value of the lowest priority
+ // (highest numbered) dispatch queue. This is global, over all modes,
+ // so don't overwrite a smaller value.
+ if (increasing_priority_)
+ {
+ if (current_priority - minimum_priority >
+ (int) minimum_priority_queue ())
+ {
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf ("set minimum_priority_queue to %d = "
+ " %d - %d\n",
+ current_priority - minimum_priority,
+ current_priority, minimum_priority);
+ }
+ minimum_priority_queue (current_priority - minimum_priority);
+ }
+ }
+ else
+ {
+ if (minimum_priority - current_priority >
+ (int) minimum_priority_queue ())
+ {
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf ("set minimum_priority_queue to %d = "
+ " %d - %d\n",
+ current_priority - minimum_priority,
+ current_priority, minimum_priority);
+ }
+ minimum_priority_queue (minimum_priority - current_priority);
+ }
+ }
+
+ // Load RT_Info pointers into ordered_info_ array for efficient lookup.
+ RT_Info ***entry;
+ ACE_Unbounded_Set_Iterator <RT_Info **> task_entries_i (task_entries_);
+ while (task_entries_i.next (entry) != 0)
+ {
+ task_entries_i.advance ();
+ if ((*entry) [mode ()] != 0)
+ {
+ // This mode has a non-zero RT_Info pointer.
+ ordered_info_ [(*entry) [mode ()]->handle - 1][mode ()] =
+ (*entry) [mode ()];
+ }
+ // else, just leave the ordered_info_ entry for this [task][mode] at 0.
+ }
+
+ const u_int harmonically_related =
+ harmonically_related_periods (sorted_rt_info,
+ threads (),
+ frame_size_ [mode ()]);
+
+ if (timeline_filename_ != 0)
+ {
+ status_t timeline_status;
+ if ((timeline_status = generate_timeline (sorted_rt_info,
+ threads (),
+ frame_size_ [mode ()],
+ timeline_ [mode()])) !=
+ SUCCEEDED)
+ {
+ status (timeline_status);
+ }
+ }
+
+ delete [] sorted_rt_info;
+ sorted_rt_info = 0;
+
+ // Calculate the utilization bound, based on whether or not the
+ // task periods are harmonically related.
+ double utilization_bound;
+
+ if (harmonically_related)
+ {
+ utilization_bound = 1.0;
+ }
+ else
+ {
+ utilization_bound = threads () * (::pow ((double) 2, 1./threads ()) - 1);
+ }
+
+ // Don't overwrite status if an error had already been noted.
+ if (status () == NOT_SCHEDULED)
+ {
+ // Compare the total utilization to the utilization bound
+ // to determine whether or not the threads are schedulable.
+ status (utilization <= utilization_bound
+ ? SUCCEEDED
+ : ST_UTILIZATION_BOUND_EXCEEDED);
+ }
+
+ // ???? if utilization bound is exceeeded, then should try all
+ // possible task phasings (RT test)
+
+ if (output_level () >= 1)
+ {
+ ACE_OS::printf ("mode %u: utilization bound: %g; "
+ "total CPU utilization: %g: ",
+ mode (),
+ utilization_bound,
+ utilization);
+ Scheduler::output (stdout, status ());
+ ACE_OS::printf ("\n\n");
+ }
+
+ return status ();
+}
+
+
+u_int
+Scheduler_Internal::find_number_of_threads (mode_t mode)
+{
+ u_int number_of_threads = 0;
+
+ // Quickly traverse RT_Info's to determine number of
+ // threads, so that the thread_ array can be allocated below.
+ RT_Info ***entry;
+ ACE_Unbounded_Set_Iterator <RT_Info **> task_entries_i (task_entries_);
+ while (task_entries_i.next (entry) != 0)
+ {
+ task_entries_i.advance ();
+ RT_Info *rt_info = (*entry) [mode];
+
+ // This test misses thread delineators that are 0 in a particular
+ // mode.
+ if (rt_info != 0 &&
+ (rt_info->threads > 0 ||
+ (number_of_dependencies (rt_info) == 0
+ && rt_info->period > 0)))
+ {
+ // This mode's RT_Info instance either has more than 0
+ // "internal" threads, or delineates a thread because it
+ // has no dependencies and has a non-zero period.
+ int nt = rt_info->threads > 0 ? rt_info->threads : 1;
+ number_of_threads += nt;
+ if (output_level () >= 2)
+ {
+ ACE_OS::printf ("find_number_of_threads (): mode %u; entry %s; "
+ "added %u threads\n",
+ mode,
+ (const char*)rt_info->entry_point,
+ nt);
+ }
+ }
+ }
+
+ if (output_level () >= 1)
+ {
+ ACE_OS::printf ("find_number_of_threads (): mode %u; "
+ "identified %lu threads\n",
+ mode, number_of_threads);
+ }
+
+ return number_of_threads;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::find_thread_delineators (mode_t mode)
+{
+ ACE_NEW_RETURN (dependencies_,
+ ACE_Bounded_Set <const RT_Info *> (tasks ()),
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ // Fill in the thread_ array. While doing this, load the
+ // dependencies set also.
+ RT_Info ***entry;
+ ACE_Unbounded_Set_Iterator <RT_Info **> task_entries_i (task_entries_);
+ while (task_entries_i.next (entry) != 0)
+ {
+ task_entries_i.advance ();
+ RT_Info *rt_info = (*entry) [mode];
+
+ if (rt_info != 0)
+ {
+ if ((rt_info->threads > 0 ||
+ (number_of_dependencies (rt_info) == 0 &&
+ rt_info->period > 0)))
+ {
+ // This mode's RT_Info instance either has more than 0
+ // "internal" threads, or delineates a thread because it
+ // has no dependencies and has a non-zero period.
+
+ if (output_level () >= 5)
+ {
+ ACE_OS::printf ("find_thread_delineators (); %s is a leaf and"
+ " has %u threads\n",
+ (const char*)rt_info->entry_point,
+ rt_info->threads);
+ }
+
+#if 1
+ // TODO: This seems to break several invariants on the
+ // RT_Info collection, I must talk to David about it.
+
+ // Add one thread for non-active objects, and the number of
+ // threads otherwise.
+ for (u_int i = 0;
+ i < (rt_info->threads > 0 ? rt_info->threads : 1);
+ ++i)
+ {
+ RT_Info *thread_info;
+ // Set "name" of thread to be that of its root RT_Info.
+ ACE_NEW_RETURN (thread_info, RT_Info,
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ thread_info->entry_point = rt_info->entry_point;
+ thread_info->threads = 0;
+ thread_info->period = 0;
+ Dependency_Info tmp;
+ tmp.number_of_calls = 0;
+ tmp.rt_info = rt_info->handle;
+ Scheduler::add_dependency (thread_info, tmp);
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("bind thread delineator %s\n",
+ (const char*)thread_info->entry_point);
+ }
+
+ thread_info_ [mode].bind ((const char*)rt_info->entry_point,
+ thread_info);
+ }
+#endif
+ }
+
+ for (u_int dep = 0;
+ dep < number_of_dependencies (rt_info);
+ ++dep)
+ {
+ RT_Info* info;
+ this->lookup_rt_info (rt_info->dependencies[dep].rt_info, info);
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("insert dependency %s\n",
+ (const char*)info->entry_point);
+
+ }
+ if (dependencies_->insert (info) == -1)
+ {
+ return ST_VIRTUAL_MEMORY_EXHAUSTED;
+ }
+ }
+
+ }
+ }
+
+ return SUCCEEDED;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::find_dependency_chain_roots (mode_t mode)
+{
+ ACE_NEW_RETURN (roots_,
+ ACE_Bounded_Set <RT_Info *> (tasks ()),
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ // Now do the fun traversal through all RT_Infos to look for roots of
+ // dependency trees. From each of those roots, traverse the dependency
+ // tree back to each leaf, which is one of the thread delineators that
+ // was found earlier.
+ RT_Info ***entry;
+ ACE_Unbounded_Set_Iterator <RT_Info **> task_entries_i (task_entries_);
+ while (task_entries_i.next (entry) != 0)
+ {
+ task_entries_i.advance ();
+ RT_Info *rt_info = (*entry) [mode];
+
+ if (rt_info != 0 && dependencies_->find (rt_info) == -1)
+ {
+ if (output_level () >= 5)
+ {
+ ACE_OS::printf ("\"%s\" is not a dependent task (it is a "
+ "dependency-chain root); it has "
+ "%u dependencies\n",
+ (const char*)rt_info->entry_point,
+ number_of_dependencies (rt_info));
+ }
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("insert root %s\n",
+ (const char*)rt_info->entry_point);
+ }
+ roots_->insert (rt_info);
+ }
+ }
+
+ return SUCCEEDED;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::find_dependency_chain_leaves ()
+{
+ RT_Info **root;
+ ACE_Map_Manager <RT_Info *, Sub_Priority, ACE_Null_Mutex>
+ root_subpriorities;
+
+ // Search through all of the dependency chain roots and assign
+ // subpriorities to them. In effect, this sorts the roots by
+ // importance.
+
+ Sub_Priority current_subpriority = 0;
+ ACE_Bounded_Set_Iterator <RT_Info *> roots_i1 (*roots_);
+ while (roots_i1.next (root) != 0)
+ {
+ roots_i1.advance ();
+ RT_Info *rt_info = *root;
+
+ if (rt_info == 0) continue; // The task does not run in this mode.
+
+ // If we've seen the root already, ignore it. Otherwise,
+ // consider it a candidate as the lowest-importance root.
+ RT_Info **min_importance_root;
+ RtecScheduler::Importance root_importance;
+ if (root_subpriorities.find (*root) == -1)
+ {
+ if (output_level () >= 6)
+ {
+ ACE_OS::printf ("find_dependency_chain_leaves (); root \"%s\" "
+ "has not yet been visited\n",
+ rt_info ? (const char*)rt_info->entry_point : "NULL");
+ }
+ min_importance_root = root;
+ root_importance = (*root)->importance;
+ }
+ else
+ {
+ if (output_level () >= 6)
+ {
+ ACE_OS::printf ("find_dependency_chain_leaves (); root \"%s\" "
+ "has already been visited\n",
+ rt_info ? (const char*)rt_info->entry_point : "NULL");
+ }
+ min_importance_root = 0;
+ root_importance = (RtecScheduler::Importance) 0xFFFFFFFF;
+ }
+
+ RT_Info **root2;
+ ACE_Bounded_Set_Iterator <RT_Info *> roots_i2 (*roots_);
+ while (roots_i2.next (root2) != 0)
+ {
+ roots_i2.advance ();
+ if (root2 == root || *root2 == 0) continue;
+
+ RtecScheduler::Importance root2_importance = (*root2)->importance;
+
+ if ((min_importance_root == 0 ||
+ root2_importance < root_importance) &&
+ root_subpriorities.find (*root2) == -1)
+ {
+ min_importance_root = root2;
+ root_importance = root2_importance;
+ }
+ }
+
+ // At this point, min_importance_root contains the root with
+ // the lowest importance, among all those that we haven't visited yet.
+ if (output_level () >= 6)
+ {
+ ACE_OS::printf ("lowest importance root is \"%s\"\n",
+ (const char*)(*min_importance_root)->entry_point);
+ }
+
+ int result;
+ if ((result = root_subpriorities.bind (*min_importance_root,
+ current_subpriority++)) != 0)
+ {
+ ACE_OS::fprintf (stderr,
+ "Scheduler_Internal::find_dependency_chain_leaves ();"
+ "bind of %s to %d failed with result %d!!!!\n",
+ (const char*)(*min_importance_root)->entry_point,
+ current_subpriority,
+ result);
+ return ST_VIRTUAL_MEMORY_EXHAUSTED;
+ }
+ else
+ {
+ if (output_level () >= 6)
+ {
+ ACE_OS::fprintf (stderr,
+ "Scheduler_Internal::find_dependency_chain_leaves ();"
+ "bind of \"%s\" to %d succeeded.\n",
+ (const char*)(*min_importance_root)->entry_point,
+ current_subpriority);
+ }
+
+ Sub_Priority subp;
+ root_subpriorities.find (*min_importance_root, subp);
+ (*min_importance_root)->subpriority = subp;
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("\"%s\" assigned subpriority %d\n\n",
+ (const char*)(*min_importance_root)->entry_point,
+ subp);
+ }
+ }
+ }
+
+ size_t roots = root_subpriorities.current_size ();
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("%u roots\n", roots);
+ }
+
+ // Sort the roots by importance, least first.
+ u_int i;
+ RT_Info **sorted_root;
+ ACE_NEW_RETURN (sorted_root, RT_Info *[roots], ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ RT_Info **visited_root;
+ ACE_NEW_RETURN (visited_root,
+ RT_Info *[roots],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ u_int next_visited_root = 0;
+ for (i = 0; i < roots; ++i)
+ {
+ visited_root[i] = 0;
+ }
+
+ Sub_Priority min_subp;
+ RT_Info *min_subp_root = 0;
+ for (i = 0; i < roots; ++i)
+ {
+ min_subp = 0x7FFF;
+
+ ACE_Bounded_Set_Iterator <RT_Info *> roots_i3 (*roots_);
+ while (roots_i3.next (root) != 0)
+ {
+ roots_i3.advance ();
+ RT_Info *rt_info = *root;
+
+ if (output_level () >= 6)
+ {
+ ACE_OS::printf ("find_dependency_chain_leaves (); "
+ "sorted root \"%s\"\n",
+ rt_info ? (const char*)rt_info->entry_point : "NULL");
+ }
+
+ if (rt_info == 0) continue; // The task does not run in this mode.
+ u_int next_root = 0;
+ for (u_int j = 0; j < roots; ++j)
+ {
+ if (visited_root[j] == rt_info) next_root = 1;
+ }
+ if (next_root == 1) continue;
+
+ if (min_subp > rt_info->subpriority)
+ {
+ min_subp = rt_info->subpriority;
+ min_subp_root = rt_info;
+ }
+ }
+
+ sorted_root[i] = min_subp_root;
+ visited_root[next_visited_root++] = min_subp_root;
+ }
+
+ delete [] visited_root;
+
+ // Now do the fun traversal from each root of a dependency chain.
+ // From each of those roots, traverse the dependency chain back to
+ // each leaf, which is one of the thread delineators that was found earlier.
+ for (i = 0; i < roots; ++i)
+ {
+ if (sorted_root[i] == 0) break;
+
+ RT_Info *rt_info = sorted_root[i];
+
+ if (rt_info == 0) continue; // The task does not run in this mode.
+
+ // Update the subpriority of this task: set it to the minimum
+ // subpriority if it hadn't already been set.
+ if (rt_info->subpriority < 0)
+ {
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("find_dependency_chain_leaves (); "
+ "set subpriority of %s to %u\n",
+ (const char*)rt_info->entry_point,
+ ACE_Scheduler_MIN_SUB_PRIORITY);
+ }
+ rt_info->subpriority = ACE_Scheduler_MIN_SUB_PRIORITY;
+ }
+
+ // Update the subpriority of all dependent tasks.
+ // update_dependencies () is recursive, so set up the visited_
+ // structure outside of it.
+ ACE_NEW_RETURN (visited_,
+ ACE_Bounded_Set <const RT_Info *> (tasks ()),
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ if (status () == NOT_SCHEDULED /* first mode */ ||
+ status () == SUCCEEDED /* subsequent modes */ )
+ {
+ Sub_Priority subp;
+ root_subpriorities.find (rt_info, subp);
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("update_dependencies (); call for "
+ "root %s to set subpriorities, starting with "
+ "%d\n",
+ (const char*)rt_info->entry_point,
+ subp);
+ }
+
+ status (update_dependencies (*rt_info, subp));
+ }
+
+ delete visited_;
+ visited_ = 0;
+ }
+
+ delete [] sorted_root;
+
+ return SUCCEEDED;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::identify_threads ()
+{
+ status_t temp_status;
+
+ reset ();
+
+ // Figure out how many threads there are in this mode.
+ threads (find_number_of_threads (mode ()));
+
+ // Find and store the thread delineators: they have no dependencies
+ // and have a specified rate, or they have internal threads of their own.
+ if ((temp_status = find_thread_delineators (mode ())) != SUCCEEDED)
+ {
+ return temp_status;
+ }
+
+ // Find and store dependency-chain roots.
+ if ((temp_status = find_dependency_chain_roots (mode ())) != SUCCEEDED)
+ {
+ return temp_status;
+ }
+
+ // Find and store dependency-chain leaves.
+ if ((temp_status = find_dependency_chain_leaves ()) != SUCCEEDED)
+ {
+ return temp_status;
+ }
+
+ return SUCCEEDED;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::aggregate_thread_parameters ()
+{
+ ACE_NEW_RETURN (leaf_info_, Thread_Map (),
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ ACE_Bounded_Set_Iterator <RT_Info *> roots_i (*roots_);
+ RT_Info **root;
+ while (roots_i.next (root))
+ {
+ roots_i.advance ();
+ if (*root != 0)
+ {
+ RT_Info &rt_info = **root;
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("root: %s\n", (const char*)rt_info.entry_point);
+ }
+
+ RT_Info leaf_info (rt_info);
+ RT_Info *leaf = &rt_info;
+
+ for (u_int i = 0; i < number_of_dependencies (rt_info); ++i)
+ {
+ RT_Info* info;
+ this->lookup_rt_info(rt_info.dependencies[i].rt_info, info);
+ leaf =
+ &calculate_thread_properties (leaf_info,
+ *info,
+ rt_info.dependencies[i].
+ number_of_calls);
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("reached leaf %s\n",
+ (const char*)leaf->entry_point);
+ }
+ }
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("root %s maps to leaf %s\n",
+ (const char*)rt_info.entry_point,
+ (const char*)leaf->entry_point);
+ }
+ leaf_info_->bind ((const char*)rt_info.entry_point, leaf);
+
+ RT_Info *thread_info = 0;
+ thread_info_ [mode ()].find ((const char*)leaf->entry_point,
+ thread_info);
+ if (thread_info == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Task \"%s\" depends on a thread identified "
+ "by \"%s\", which does not \n"
+ "have a period or internal threads. "
+ "Is that dependency backwards?\n",
+ (const char*)rt_info.entry_point,
+ (const char*)leaf->entry_point));
+ }
+ ACE_ASSERT (thread_info != 0);
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("found thread_info entry %s\n",
+ (const char*)thread_info->entry_point);
+ }
+
+ // Add the dependency chain's aggregate parameters to that
+ // of the thread.
+ (void) operator+= (thread_info, leaf_info);
+ }
+ }
+
+ return SUCCEEDED;
+}
+
+
+RtecScheduler::RT_Info &
+Scheduler_Internal::calculate_thread_properties (RT_Info &thread_info,
+ RT_Info &rt_info,
+ const u_int number_of_calls)
+{
+ u_int i;
+
+ for (i = 0; i < number_of_calls; ++i)
+ {
+ (void) operator+= (&thread_info, rt_info);
+ }
+
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("calculate_thread_properties (); "
+ "time: %ld, period: %ld usec\n",
+#if defined (ACE_WIN32) || defined (ACE_HAS_LONGLONG_T)
+ thread_info.worst_case_execution_time,
+#else
+ thread_info.time.lo (),
+#endif /* ACE_WIN32 || ACE_HAS_LONGLONG_T */
+ thread_info.period / 10 /* usec/100 ns */);
+ }
+
+ if (number_of_dependencies (rt_info) == 0)
+ {
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("calculate_thread_properties (); "
+ "reached leaf %s\n",
+ (const char*)rt_info.entry_point);
+ }
+ return rt_info;
+ }
+
+#if 0
+ for (i = 0; i < number_of_dependencies (rt_info); ++i )
+ {
+ // TODO:
+ if (rt_info.dependencies[i].rt_info.value() != 0)
+ {
+ RT_Info info;
+ rt_info.dependencies[i].rt_info >>= &info;
+ if (output_level () >= 4)
+ {
+ ACE_OS::printf ("calculate_thread_properties (): recurse on "
+ "dependency %s\n",
+ (const char*)info.entry_point);
+ }
+
+ RT_Info& ret =
+ calculate_thread_properties (thread_info,
+ info,
+ rt_info.dependencies[i].
+ number_of_calls);
+ return ret;
+ }
+ }
+#endif /* 0 */
+
+ ACE_ASSERT (! "should never reach this!"); // should never get here!
+ return rt_info; // to avoid compilation warning
+}
+
+
+int
+Scheduler_Internal::priority (const handle_t handle,
+ OS_Thread_Priority &priority,
+ Sub_Priority &subpriority,
+ Preemption_Priority &preemption_prio,
+ const mode_t requested_mode) const
+{
+ // Casting away the const.
+ ACE_Guard<LOCK> ace_mon (((Scheduler_Internal *) this)->lock_);
+
+ const mode_t lookup_mode = requested_mode == CURRENT_MODE
+ ? mode ()
+ : requested_mode;
+
+ if (!ordered_info_)
+ {
+ priority = minimum_priority_;
+ subpriority = ACE_Scheduler_MIN_SUB_PRIORITY;
+ preemption_prio = ACE_Scheduler_MAX_PREEMPTION_PRIORITY;
+ return 0;
+ }
+ else if (lookup_mode < modes () && handle <= handles_ &&
+ ordered_info_ [handle - 1][lookup_mode] != 0)
+ {
+ priority = ordered_info_ [handle - 1][lookup_mode]->priority;
+ subpriority = ordered_info_ [handle - 1][lookup_mode]->subpriority;
+
+ if (increasing_priority_)
+ {
+#if defined (ACE_WIN32)
+ // Find the queue_number by iterating over the OS thread priorities.
+ // This allows proper handling of non-contiguous OS priorities.
+ // It would be more efficient to store the queue number in the
+ // RT_Info instead of computing it here every time. This is only
+ // intended for off-line scheduling, though, so it's not critical.
+ // TODO: // ???? Hard-code knowledge of 5 dispatch queues!!
+ preemption_prio = 4;
+ for (ACE_Sched_Priority p =
+ ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
+ ACE_SCOPE_PROCESS);
+ priority > p;
+ p = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
+ p,
+ ACE_SCOPE_PROCESS))
+ {
+ --preemption_prio;
+ }
+#else /* ! ACE_WIN32 */
+ // E.g., Solaris, which has contiguous priorities.
+ preemption_prio = minimum_priority_queue () -
+ (priority - minimum_priority_);
+#endif /* ! ACE_WIN32 */
+ }
+ else
+ {
+ // Assume VxWorks, which has contiguous priorities.
+ preemption_prio = minimum_priority_queue () -
+ (minimum_priority_ - priority);
+ }
+
+ // TODO: This should be updated when priority and subpriority
+ // are set, but I don't know when that happens :(
+ ordered_info_ [handle - 1][lookup_mode]->preemption_priority =
+ preemption_prio;
+
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf ("preemption_prio %d: min %d, pri %d, min_pri %d\n",
+ preemption_prio, minimum_priority_queue (),
+ priority, minimum_priority_);
+ }
+
+ return 0;
+ } else {
+ return -1;
+ }
+}
+
+
+void
+Scheduler_Internal::print_schedule ()
+{
+ for (mode_t m = 0; m < modes (); ++m)
+ {
+ ACE_OS::printf ("\nMode %u:\n", m);
+ ACE_OS::printf ("Task Priority Subpri- CPU Time Period Rate "
+ "Utilization Name\n"
+ " ority microsec microsec Hz\n"
+ "---- -------- ------- -------- -------- ---- "
+ "----------- ----\n");
+
+ // at 1 and incrementing by 1.
+ for (u_int task = 1; task <= tasks (); ++task)
+ {
+ RtecScheduler::OS_Priority prio;
+ RtecScheduler::Sub_Priority subpriority;
+ RtecScheduler::Preemption_Priority preemption_prio;
+ if (priority (task,
+ prio,
+ subpriority,
+ preemption_prio,
+ m) == -1)
+ {
+ ACE_OS::printf ("%3u -- -- -- "
+ " -- -- -- %s\n",
+ task,
+ (const char*)ordered_info_[task-1][m]->entry_point);
+ }
+ else
+ {
+#if defined (ACE_WIN32) || defined (ACE_HAS_LONGLONG_T)
+ const u_long t =
+ (u_long) ordered_info_ [task-1][m]->worst_case_execution_time /
+ 10 /* microsec/100 ns */;
+#else
+ const u_long t = ordered_info_ [task-1][m]->time.lo () /
+ 10 /* microsec/100 ns */;
+#endif /* ACE_WIN32 || ACE_HAS_LONGLONG_T */
+
+ ACE_OS::printf ("%3u %6d %6d %8lu"
+ "%9lu%5lu %6.4f %s\n",
+ task, prio, subpriority, t,
+ (u_long) (ordered_info_ [task-1][m]->period /
+ 10 /* microsec/100 ns */),
+ ordered_info_ [task-1][m]->period > 0
+ ? (u_long) (1.0e7 /
+ ordered_info_ [task-1][m]->
+ period)
+ : 0L,
+ ordered_info_ [task-1][m]->period > 0
+ ? (double) t /
+ ordered_info_ [task-1][m]->period
+ : 0.0,
+ (const char*)ordered_info_[task-1][m]->entry_point);
+ }
+ }
+ }
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::store_schedule (const char *filename)
+{
+ u_int i;
+ FILE *const file = ACE_OS::fopen (filename, "w");
+
+ if (file)
+ {
+ ACE_OS::fprintf (file, "\
+// Automatically generated \"%s\"\n\
+\n\
+#include \"Scheduler_Runtime.h\"\n\
+\n\
+static const unsigned int MODES = %u;\n\
+static const unsigned int TASKS = %u;\n\
+static const unsigned int THREADS = %u;\n\
+static const unsigned int MINIMUM_PRIORITY_QUEUE = %u;\n\
+\n\
+int\n\
+Scheduler_Runtime_registered_tasks_ [TASKS] = { 0 };\n\
+\n\
+const char *\n\
+Scheduler_Runtime_task_names_ [TASKS] =\n\
+ {\n\
+", filename,
+ modes (),
+ tasks (),
+ threads (),
+ minimum_priority_queue ());
+
+ for (i = 0; i < tasks (); ++i)
+ {
+ ACE_OS::fprintf (file, " \"%s\"%s\n",
+ (const char*)ordered_info_ [i][0]->entry_point,
+ i == tasks () - 1 ? "" : ",");
+ }
+
+ ACE_OS::fprintf (file, "\
+ };\n\
+\n\
+int\n\
+Scheduler_Runtime_priorities_ [MODES][TASKS][3] =\n\
+ {\n\
+");
+
+ for (i = 0; i < modes (); ++i)
+ {
+ ACE_OS::fprintf (file, " { /* mode %u */\n", i);
+ for (u_int j = 0; j < tasks (); ++j)
+ {
+ RtecScheduler::OS_Priority priority;
+ RtecScheduler::Sub_Priority subpriority;
+ RtecScheduler::Preemption_Priority preemption_prio;
+ if (ordered_info_ [j][i] == 0)
+ {
+ // This task doesn't run in this mode.
+ priority = increasing_priority_ ? minimum_priority_ - 1
+ : minimum_priority_ + 1;
+ subpriority = -1;
+ preemption_prio = minimum_priority_queue () + 1;
+ }
+ else
+ {
+ this->priority (j+1, priority, subpriority, preemption_prio, i);
+ }
+
+ ACE_OS::fprintf (file, " { %d, %d, %u }%s\n",
+ priority,
+ subpriority,
+ preemption_prio,
+ j == tasks () - 1 ? "" : ",");
+ }
+ ACE_OS::fprintf (file, " }%s /* end mode %u */\n",
+ i == modes () - 1 ? "" : ",", i);
+ }
+
+ ACE_OS::fprintf (file, "\
+ };\n\
+\n\
+unsigned int\n\
+Scheduler_Runtime::modes ()\n\
+{\n\
+ return MODES;\n\
+}\n\
+\n\
+unsigned int\n\
+Scheduler_Runtime::tasks ()\n\
+{\n\
+ return TASKS;\n\
+}\n\
+\n\
+unsigned int\n\
+Scheduler_Runtime::threads ()\n\
+{\n\
+ return THREADS;\n\
+}\n\
+\n\
+unsigned int\n\
+Scheduler_Runtime::minimum_priority_queue ()\n\
+{\n\
+ return MINIMUM_PRIORITY_QUEUE;\n\
+}\n\
+\n\
+const char *\n\
+Scheduler_Runtime::task_name (const unsigned int handle)\n\
+{\n\
+ return Scheduler_Runtime_task_names_ [handle - 1];\n\
+}\n\
+\n\
+int\n\
+Scheduler_Runtime::priority (const unsigned int mode,\n\
+ const unsigned int handle)\n\
+{\n\
+ return Scheduler_Runtime_priorities_ [mode][handle - 1][0];\n\
+}\n\
+\n\
+int\n\
+Scheduler_Runtime::subpriority (const unsigned int mode,\n\
+ const unsigned int handle)\n\
+{\n\
+ return Scheduler_Runtime_priorities_ [mode][handle - 1][1];\n\
+}\n\
+\n\
+int\n\
+Scheduler_Runtime::preemption_prio (const unsigned int mode,\n\
+ const unsigned int handle)\n\
+{\n\
+ return Scheduler_Runtime_priorities_ [mode][handle - 1][2];\n\
+}\n\
+\n\
+unsigned int\n\
+Scheduler_Runtime::config ()\n\
+{\n\
+ return 0;\n\
+}\n\
+\n\
+unsigned int\n\
+Scheduler_Runtime::find (const char *operation_name)\n\
+{\n\
+ for (unsigned int i = 0; i < TASKS; ++i)\n\
+ if (! ACE_OS::strcmp (operation_name,\n\
+ Scheduler_Runtime_task_names_ [i]))\n\
+ return i + 1;\n\
+\n\
+ return 0;\n\
+}\n\
+\n\
+unsigned int\n\
+Scheduler_Runtime::register_task (const unsigned int task)\n\
+{\n\
+ if (Scheduler_Runtime_registered_tasks_ [task - 1] == 1)\n\
+ {\n\
+ return 0;\n\
+ }\n\
+ else\n\
+ {\n\
+ Scheduler_Runtime_registered_tasks_ [task - 1] = 1;\n\
+ return task;\n\
+ }\n\
+}\n\
+\n\
+");
+
+ if (ACE_OS::fprintf (file, "// EOF\n") > 0 &&
+ ACE_OS::fclose (file) == 0)
+ {
+ return SUCCEEDED;
+ }
+ else
+ {
+ return UNABLE_TO_WRITE_SCHEDULE_FILE;
+ }
+ }
+ else
+ {
+ return UNABLE_TO_OPEN_SCHEDULE_FILE;
+ }
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::store_rt_info (const char *filename)
+{
+ FILE *file = ACE_OS::fopen (filename, "w");
+ if (file)
+ {
+ const time_t now = ACE_OS::time (0);
+
+ (void) ACE_OS::fprintf (file,
+ "# RT_Info provided for \"%s\" %s"
+ "# Version 1.1\n"
+ "# Format for each entry:\n"
+ "# entry name\n"
+ "# handle\n"
+ "# worst case execution time\n"
+ "# typical execution time\n"
+ "# cached execution time\n"
+ "# period\n"
+ "# importance\n"
+ "# quantum\n"
+ "# begin dependencies\n"
+ "# number of dependencies\n"
+ "# entry name, number of calls "
+ "(one of these lines per dependency, if any)\n"
+ "# end dependencies\n"
+ "# priority\n"
+ "# order within priority\n\n"
+ "%u modes\n%u operations\n\n",
+ filename, ACE_OS::ctime (&now),
+ modes (), tasks ());
+
+ RT_Info ***entry;
+ ACE_Unbounded_Set_Iterator <RT_Info **>
+ task_entries_i (task_entries_);
+ while (task_entries_i.next (entry) != 0)
+ {
+ task_entries_i.advance ();
+ export( (*entry) [0], file);
+ }
+ }
+ else
+ {
+ return UNABLE_TO_OPEN_SCHEDULE_FILE;
+ }
+
+ if (ACE_OS::fprintf (file, "\n# end of file\n", 1) > 0 &&
+ ACE_OS::fclose (file) == 0)
+ {
+ return SUCCEEDED;
+ }
+ else
+ {
+ return UNABLE_TO_WRITE_SCHEDULE_FILE;
+ }
+}
+
+
+// This implementation is incredibly ugly, but it sometimes works. The
+// timeline viewer accepts start/stop pairs by task, and figures out the
+// preemption. So, it's not necessary to figure out the preemptions.
+Scheduler::status_t
+Scheduler_Internal::generate_timeline (
+ Mode_Entry const sorted_rt_info [],
+ const u_int number_of_tasks,
+ u_long frame_size,
+ ACE_Unbounded_Queue <Timeline_Entry> &jobs)
+{
+ if (number_of_tasks > 0)
+ {
+ u_long start = 0;
+ u_long stop = 0;
+ u_int i;
+ u_long *next_start;
+ u_long *leftover;
+
+ ACE_NEW_RETURN (next_start, u_long [number_of_tasks],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+ ACE_NEW_RETURN (leftover, u_long [number_of_tasks],
+ ST_VIRTUAL_MEMORY_EXHAUSTED);
+
+ for (i = 0; i < number_of_tasks; ++i)
+ {
+ next_start [i] = 0;
+ leftover [i] = 0;
+ }
+
+ while (stop <= frame_size)
+ {
+ for (i = number_of_tasks; i > 0; --i)
+ {
+ u_long execution_time = 0; // microseconds
+
+ if (start < next_start [i - 1])
+ {
+ if (leftover [i - 1] == 0)
+ {
+ // Not at this task's next start period, and it
+ // has no leftover work in it's current period,
+ // so move on to the next task.
+
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf (" continue for task %lu\n",
+ sorted_rt_info [i - 1].rt_info_->handle);
+ }
+
+ continue;
+ }
+ else
+ {
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf (" leftover for task %lu\n",
+ sorted_rt_info [i - 1].rt_info_->handle);
+ }
+
+ execution_time = leftover [i - 1];
+ leftover [i - 1] = 0;
+ }
+ }
+ else
+ {
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf (" task %s reached next start of"
+ " %lu (at %lu)\n",
+ (const char*)sorted_rt_info [i - 1].rt_info_->
+ entry_point,
+ next_start [i - 1],
+ start);
+ }
+
+ execution_time = (u_long)
+ (sorted_rt_info [i - 1].rt_info_->worst_case_execution_time /
+ 10 /* us/100 ns */);
+
+ next_start [i - 1] +=
+ (u_long) (sorted_rt_info [i - 1].rt_info_->period /
+ 10 /* usec/100 ns */);
+
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf (" loaded next_start of %lu with "
+ "%lu\n",
+ sorted_rt_info [i - 1].rt_info_->
+ handle,
+ next_start [i - 1]);
+ }
+ }
+
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf (" handle: %d, "
+ " execution_time: %lu, "
+ " leftover: %lu\n",
+ sorted_rt_info [i - 1].rt_info_->handle,
+ execution_time,
+ leftover [i - 1]);
+ }
+
+ // Look for a start time of a higher priority task that
+ // is before this one can finish.
+ int will_finish = 1;
+ for (u_int j = number_of_tasks; j > i; --j)
+ {
+ // Skip over groups of array entries with the same period.
+ if (j < number_of_tasks &&
+ sorted_rt_info [j - 1].rt_info_->period ==
+ sorted_rt_info [j].rt_info_->period)
+ {
+ break;
+ }
+
+ if (next_start [j - 1] > 0 &&
+ next_start [j - 1] <= start + execution_time)
+ {
+ leftover [i - 1] = execution_time -
+ (next_start [j - 1] - start);
+ execution_time = next_start [j - 1] - start;
+ will_finish = 0;
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf (" handle: %d, "
+ " execution_time: %lu, "
+ " leftover: %lu\n",
+ sorted_rt_info [i - 1].rt_info_->
+ handle,
+ execution_time,
+ leftover [i - 1]);
+ }
+ }
+
+ if (output_level () >= 2)
+ {
+ ACE_OS::printf (" period: %ld, time: %lu usec, "
+ " period ratio: %lu, "
+ " execution_time: %lu usec\n",
+ sorted_rt_info [j-1].rt_info_->
+ period / 10 /* usec/100 ns */,
+ (u_long) (sorted_rt_info [j-1].rt_info_->
+ worst_case_execution_time / 10 /* usec/100 ns */),
+ sorted_rt_info [j-1].rt_info_->period
+ > 0
+ ? (u_long) (sorted_rt_info [i-1].
+ rt_info_->period /
+ sorted_rt_info [j-1].
+ rt_info_->period)
+ : 0,
+ execution_time / 10 /* usec/100 ns */);
+ }
+ }
+
+ if (output_level () >= 3)
+ {
+ ACE_OS::printf (" period: %ld usec, time: %lu usec, "
+ " execution_time: %lu usec\n",
+ sorted_rt_info [i - 1].rt_info_->
+ period / 10 /* usec/100 ns */,
+ (u_long) (sorted_rt_info [i - 1].rt_info_->
+ worst_case_execution_time / 10 /* usec/100 ns */),
+ execution_time / 10 /* usec/100 ns */);
+ }
+
+ jobs.enqueue_head (Timeline_Entry (sorted_rt_info [i - 1].rt_info_->
+ handle,
+ sorted_rt_info [i - 1].rt_info_->
+ entry_point,
+ start,
+ stop = start + execution_time,
+ next_start [i - 1]));
+ start = stop;
+
+ if (! will_finish)
+ {
+ // don't bother to visit any other tasks: restart
+ // with the highest priority task
+ break;
+ }
+ }
+
+ // figure out next start time based on periods only
+ u_long min_start = 0xFFFFFFFF;
+ for (i = 0; i < number_of_tasks; ++i)
+ {
+ if (min_start > next_start [i]) min_start = next_start [i];
+ }
+ start = min_start;
+
+ // if any tasks haven't finished the current period processing,
+ // let them try to finish by overwriting "start" with "stop"
+ for (i = 0; i < number_of_tasks; ++i)
+ {
+ if (leftover [i] > 0)
+ {
+ start = stop;
+ break;
+ }
+ }
+ }
+
+ delete [] next_start;
+ next_start = 0;
+ delete [] leftover;
+ leftover = 0;
+ }
+
+ return SUCCEEDED;
+}
+
+
+Scheduler::status_t
+Scheduler_Internal::create_timelines (const char *filename)
+{
+ // Store each mode's timeline in a different file. Append the
+ // mode identifier to filename.
+ char full_filename [MAXPATHLEN];
+ ACE_OS::strcpy (full_filename, filename);
+ char *filename_extension = full_filename + ACE_OS::strlen (filename);
+ if (filename_extension == 0)
+ {
+ return UNABLE_TO_OPEN_SCHEDULE_FILE;
+ }
+
+ status_t status = SUCCEEDED;
+
+ for (u_int mode = 0;
+ (status == SUCCEEDED || status == ST_UTILIZATION_BOUND_EXCEEDED) &&
+ mode < modes ();
+ ++mode)
+ {
+ char mode_id[128];
+ ACE_OS::sprintf (mode_id, "-mode_%d.timeline", mode + 1);
+ ACE_OS::strcpy (filename_extension, mode_id);
+
+ FILE *const file = ACE_OS::fopen (full_filename, "w");
+ if (file)
+ {
+ u_int i;
+
+ // count the number of tasks in this mode with non-null RT_Info
+ u_int nonnull_tasks = 0;
+ for (i = 0; i < tasks (); ++i)
+ {
+ if (ordered_info_ [i][mode] != 0)
+ {
+ ++nonnull_tasks;
+ }
+ }
+ ACE_OS::fprintf (file, "%u\n", nonnull_tasks); /* number_of_tasks */
+
+
+ ACE_OS::fprintf (file, "%lu\n", /* frame_size */
+ frame_size_ [mode]);
+ ACE_OS::fprintf (file, "0 %lu\n", /* start stop_times */
+ frame_size_ [mode]);
+
+ ACE_Bounded_Set <u_int> emitted_tasks (nonnull_tasks);
+ u_int max_priority = 0x7FFFFFFF;
+ for (i = 0; i < tasks (); ++i)
+ {
+ u_int highest_priority = 0x7FFFFFFF; /* corresponds to lowest
+ queue number */
+ u_int highest_priority_task = 0xFFFFFFFF;
+
+ for (u_int j = 0; j < tasks (); ++j)
+ {
+ if (ordered_info_ [j][mode] != 0)
+ {
+ RtecScheduler::OS_Priority priority;
+ RtecScheduler::Sub_Priority subpriority;
+ RtecScheduler::Preemption_Priority preemption_prio;
+ this->priority (j+1, priority, subpriority, preemption_prio,
+ mode);
+
+ if (i == 0)
+ {
+ if (max_priority > preemption_prio)
+ {
+ max_priority = preemption_prio;
+ }
+ }
+
+ if (! emitted_tasks.find (j) &&
+ highest_priority > preemption_prio)
+ {
+ highest_priority = preemption_prio;
+ highest_priority_task = j;
+ }
+ }
+ }
+
+ /* task_name priority */
+ if (highest_priority_task < 0xFFFFFFFF)
+ {
+ ACE_OS::fprintf (file, "%s %d\n",
+ /* task name */
+ (const char*)ordered_info_ [highest_priority_task][mode]->
+ entry_point,
+ /* queue number */
+ minimum_priority_queue () -
+ (increasing_priority_
+ ? ordered_info_ [highest_priority_task][mode]->
+ priority -
+ minimum_priority_
+ : minimum_priority_ -
+ ordered_info_ [highest_priority_task][mode]->
+ priority));
+
+ emitted_tasks.insert (highest_priority_task);
+ }
+ }
+
+ const u_int timeline_entries = (u_int) timeline_ [mode].size ();
+ for (i = 0; i < timeline_entries; ++i)
+ {
+ Timeline_Entry entry;
+ if (! timeline_ [mode].dequeue_head (entry))
+ {
+ ACE_OS::fprintf (file, "%s %d %s\n%s %d %d\n",
+ entry.entry_point_,
+ entry.start_,
+ "", /* label */
+ entry.entry_point_,
+ entry.stop_,
+ entry.next_start_);
+ }
+ }
+
+ if (ACE_OS::fclose (file) != 0)
+ {
+ status = UNABLE_TO_WRITE_SCHEDULE_FILE;
+ }
+ }
+ else
+ {
+ status = UNABLE_TO_OPEN_SCHEDULE_FILE;
+ }
+ }
+
+ return status;
+}
+
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Bounded_Set<RtecScheduler::RT_Info *>;
+template class ACE_Bounded_Set<const RtecScheduler::RT_Info *>;
+template class ACE_Bounded_Set<u_int>;
+template class ACE_Bounded_Set_Iterator<RtecScheduler::RT_Info *>;
+template class ACE_Node<Scheduler_Internal::Timeline_Entry>;
+template class ACE_Node<RtecScheduler::RT_Info **>;
+template class ACE_Unbounded_Queue<Scheduler_Internal::Timeline_Entry>;
+template class ACE_Unbounded_Queue_Iterator<
+ Scheduler_Internal::Timeline_Entry>;
+template class ACE_Unbounded_Set<RtecScheduler::RT_Info **>;
+template class ACE_Unbounded_Set_Iterator<RtecScheduler::RT_Info **>;
+
+template class ACE_Map_Entry <RtecScheduler::RT_Info *, Scheduler::Sub_Priority>;
+template class ACE_Map_Manager <RtecScheduler::RT_Info *, Scheduler::Sub_Priority,
+ ACE_Null_Mutex>;
+
+#if defined (ACE_HAS_THREADS)
+ template class ACE_Map_Entry<ACE_CString, RtecScheduler::RT_Info *>;
+ template class ACE_Map_Manager<ACE_CString, RtecScheduler::RT_Info *, ACE_Null_Mutex>;
+ template class ACE_Map_Iterator<ACE_CString, RtecScheduler::RT_Info *, ACE_Null_Mutex>;
+#endif /* ACE_HAS_THREADS */
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
+
+// EOF
diff --git a/TAO/local/bin/Scheduling_Service/Scheduler_Internal.h b/TAO/local/bin/Scheduling_Service/Scheduler_Internal.h
new file mode 100644
index 00000000000..45bd2060110
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Scheduler_Internal.h
@@ -0,0 +1,252 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// sched
+//
+// = FILENAME
+// Scheduler_Internal.h
+//
+// = CREATION DATE
+// 23 January 1997
+//
+// = AUTHOR
+// David Levine
+//
+// ============================================================================
+
+#if ! defined (SCHEDULER_INTERNAL_H)
+#define SCHEDULER_INTERNAL_H
+
+#include "ace/Containers.h"
+#include "ace/ACE.h"
+
+#include "Scheduler.h"
+
+struct Mode_Entry; // for internal use only
+
+class Scheduler_Internal : public ACE_Scheduler
+ // = TITLE
+ // Implementation of an off-line scheduler.
+ //
+ // = DESCRIPTION
+ // Schedules tasks using rate-monotonic scheduling.
+{
+public:
+ Scheduler_Internal ();
+ virtual ~Scheduler_Internal ();
+
+ // = Initialize the scheduler.
+ virtual void init (const int minimum_priority,
+ const int maximum_priority,
+ const char *runtime_filename = 0,
+ const char *rt_info_filename = 0,
+ const char *timeline_filename = 0);
+
+ // = Registers a task.
+ virtual status_t register_task (RT_Info *[],
+ const u_int number_of_modes,
+ handle_t &handle);
+
+ virtual status_t lookup_rt_info (handle_t handle,
+ RT_Info* &rtinfo);
+ // Obtains an RT_Info based on its "handle".
+
+ // = Computes the schedule.
+ virtual status_t schedule (void);
+
+ // = Access a thread priority.
+ virtual int priority (const handle_t handle,
+ OS_Thread_Priority &priority,
+ Sub_Priority &subpriority,
+ Preemption_Priority &preemption_prio,
+ const mode_t = CURRENT_MODE) const;
+ // Defines "priority" as the priority that was assigned to the Task that
+ // was assigned "handle", for the specified mode. Defines "subpriority"
+ // as the relative ordering (due to dependencies) within the priority.
+ // Returns 0 on success, or 1 if an invalid mode or handle are supplied.
+
+ typedef ACE_Map_Entry <ACE_CString, RT_Info *> Thread_Map_Entry;
+ typedef ACE_Map_Manager <ACE_CString, RT_Info *, ACE_Null_Mutex>
+ Thread_Map;
+ typedef ACE_Map_Iterator <ACE_CString, RT_Info *, ACE_Null_Mutex>
+ Thread_Map_Iterator;
+
+private:
+ u_int handles_;
+ // The number of task handles dispensed so far.
+
+ int minimum_priority_;
+ // The minimum priority value that the application specified (in
+ // its call to init ()).
+
+ int maximum_priority_;
+ // The maximum priority value that the application specified (in
+ // its call to init ()).
+
+ const char *runtime_filename_;
+ // Destination file of Scheduler output from the configuration run.
+
+ const char *rt_info_filename_;
+ // Destination file of all rt_info data from the configuration run.
+
+ const char *timeline_filename_;
+ // The destination of the timeline.
+
+ int increasing_priority_;
+ // Set to 1 if priority values increase with increasing priority,
+ // such as on Solaris and Win32, or 0 if they decrease, such as on
+ // VxWorks.
+
+ ACE_Unbounded_Set <RT_Info **> task_entries_;
+ // Collection of known tasks.
+
+ RT_Info ***ordered_info_;
+ // An ordered array of pointers to the RT_Info pointers stored
+ // in task_entries_. It is index by [handle][mode]. This permits
+ // efficient retrieval by get_priority ().
+
+ ACE_Bounded_Set <const RT_Info *> *visited_;
+ // When updating dependencies, use this set to keep track of
+ // visited RT_Info instances in order to detect cycles in the
+ // dependency graph. It is dynamically allocated/deallocated so that
+ // it doesn't have to be "cleaned out" manually for each mode.
+
+ ACE_Bounded_Set <RT_Info *> *leaves_;
+ // For 1) storing aggregate thread execution parameters during
+ // traversal of dependency chains, and
+ // 2) assigning priorities to all tasks.
+
+ ACE_Bounded_Set <const RT_Info *> *dependencies_;
+ // Collection of RT_Info's that are dependent tasks, for efficient
+ // identification of dependency-chain roots.
+
+ ACE_Bounded_Set <RT_Info *> *roots_;
+ // Collection of RT_Info's that are roots of dependency chains.
+
+ status_t update_dependencies (RT_Info &, Sub_Priority subpriority);
+ // For each of this task's dependencies (transitively), increment its
+ // subpriority. The higher subpriorities indicate that the dependent
+ // tasks should run before this task.
+
+ u_long *frame_size_; /* millisec */
+ // For creating timelines (array indexed by mode).
+
+ Thread_Map *thread_info_;
+ // Collection of known threads, dynamically allocated because
+ // it is reused for each mode. It consists of a amp of RT_Info
+ // instances, keyed by entry_point, that aggregate the info for the
+ // entire thread. Each instance has one dependency: the root
+ // RT_Info instance of the thread.
+ // *thread_info_ is an array, indexed by mode.
+
+ Thread_Map *leaf_info_;
+ // Mapping from roots of dependency chains to their leaves.
+
+public: // for template specialization
+ struct Timeline_Entry
+ {
+ u_long handle_;
+ const char *entry_point_;
+ u_long start_; // microseconds
+ u_long stop_; // microseconds
+ u_long next_start_;
+
+ Timeline_Entry (const u_long handle = 0,
+ const char *entry_point = 0,
+ const u_long start = 0,
+ const u_long stop = 0,
+ const u_long next_start = 0)
+ : handle_ (handle),
+ entry_point_ (entry_point),
+ start_ (start),
+ stop_ (stop),
+ next_start_ (next_start) {}
+ };
+private:
+#if defined (ACE_HAS_THREADS)
+ typedef ACE_Recursive_Thread_Mutex LOCK;
+#else
+ typedef ACE_Null_Mutex LOCK;
+#endif /* ACE_HAS_THREADS */
+
+ LOCK lock_;
+ // This protects access to the scheduler during configuration runs.
+
+ ACE_Unbounded_Queue <Timeline_Entry> *timeline_;
+ // For storing timelines.
+
+
+ ///////////////////////////////////////
+ // member functions for internal use //
+ ///////////////////////////////////////
+
+ void reset ();
+ // Prepare for another schedule computation, but do not
+ // disturb the "output" (priorities that have already been assigned).
+
+ status_t schedule_rms (const int minimum_priority,
+ const int maximum_priority);
+ // Computes the schedule using Rate Monotonic Scheduling.
+
+ RT_Info &calculate_thread_properties (RT_Info &thread_info,
+ RT_Info &rt_info,
+ const u_int number_of_calls);
+ // Computes the execution time, etc., of the thread, identified by
+ // rt_info, and store it in thread_info, by recursively traversing
+ // the RT_Info call chain. Returns the root node.
+
+ void print_schedule ();
+ // Display the schedule, task-by-task.
+
+ status_t store_schedule (const char *filename);
+ // Store the schedule in the named file.
+
+ status_t store_rt_info (const char *filename);
+ // Export all RT_Info to the named file.
+
+ status_t identify_threads ();
+ // Assembles RT_Tasks into threads.
+
+ status_t aggregate_thread_parameters ();
+ // Stores the aggregated thread parameters at each leaf (thread delineator)
+ // in the tread_info_ array.
+
+ u_int find_number_of_threads (mode_t mode);
+ // Counts the number of threads in a mode based on the task dependencies.
+
+ status_t find_thread_delineators (mode_t mode);
+ // Find and store the thread delineators: they have no dependencies
+ // and have a specified rate, or they have internal threads of their own.
+
+ status_t find_dependency_chain_roots (mode_t mode);
+ // Find and store the roots of dependency chains.
+
+ status_t find_dependency_chain_leaves ();
+ // Find and store the leaves of dependency chains.
+
+ status_t generate_timeline (
+ Mode_Entry const sorted_rt_info [],
+ const u_int number_of_tasks,
+ u_long frame_size,
+ ACE_Unbounded_Queue <Timeline_Entry> &jobs);
+
+ status_t create_timelines (const char *filename);
+ // Create a timeline for each mode.
+
+ // the following functions are not implememented
+ Scheduler_Internal (const Scheduler_Internal &);
+ Scheduler_Internal &operator= (const Scheduler_Internal &);
+};
+
+
+#if defined (__ACE_INLINE__)
+#include "Scheduler_Internal.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* SCHEDULER_INTERNAL_H */
+
+
+// EOF
diff --git a/TAO/local/bin/Scheduling_Service/Scheduler_Internal.i b/TAO/local/bin/Scheduling_Service/Scheduler_Internal.i
new file mode 100644
index 00000000000..91ee5915070
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/Scheduler_Internal.i
@@ -0,0 +1,21 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// sched
+//
+// = FILENAME
+// Scheduler_Internal.i
+//
+// = CREATION DATE
+// 23 January 1997
+//
+// = AUTHOR
+// David Levine
+//
+// ============================================================================
+
+
+// EOF
+
diff --git a/TAO/local/bin/Scheduling_Service/dump_schedule.cpp b/TAO/local/bin/Scheduling_Service/dump_schedule.cpp
new file mode 100644
index 00000000000..01fed0eed6f
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/dump_schedule.cpp
@@ -0,0 +1,67 @@
+//
+// $Id$
+//
+
+#include "ace/Sched_Params.h"
+#include "ace/Get_Opt.h"
+#include "tao/corba.h"
+
+#include "CosNamingC.h"
+#include "Scheduler_Factory.h"
+
+// This program dumps the results of one scheduling in a C++ file.
+
+
+
+int main (int argc, char *argv[])
+{
+ ACE_TRY
+ {
+ // Initialize ORB.
+ CORBA::ORB_ptr orb =
+ CORBA::ORB_init (argc, argv, "dump_schedule", ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ CORBA::POA_ptr poa =
+ orb->POA_init(argc, argv, "POA");
+ if (poa == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+ }
+
+#if 0
+ CORBA::Object_ptr objref =
+ orb->resolve_initial_references ("NameService");
+ ACE_CHECK_ENV;
+ CosNaming::NamingContext_var naming_context =
+ CosNaming::NamingContext::_narrow (objref, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ ACE_Scheduler_Factory::use_config (naming_context);
+#else
+ ACE_Scheduler_Factory::use_config (orb);
+#endif /* 0 */
+
+ RtecScheduler::RT_Info_Set* infos;
+ ACE_Scheduler_Factory::server ()->compute_scheduling
+ (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
+ ACE_SCOPE_THREAD),
+ ACE_Sched_Params::priority_max (ACE_SCHED_FIFO,
+ ACE_SCOPE_THREAD),
+ infos, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ ACE_Scheduler_Factory::dump_schedule (*infos,
+ "Scheduler_Runtime.cpp");
+ delete infos;
+ }
+ ACE_CATCH (CORBA::SystemException, sys_ex)
+ {
+ ACE_TRY_ENV.print_exception ("SYS_EX");
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/local/bin/Scheduling_Service/schedule_service.cpp b/TAO/local/bin/Scheduling_Service/schedule_service.cpp
new file mode 100644
index 00000000000..8be94d60c93
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/schedule_service.cpp
@@ -0,0 +1,71 @@
+//
+// $Id$
+//
+
+#include "tao/corba.h"
+
+#include "CosNamingC.h"
+#include "Config_Scheduler.h"
+
+int main (int argc, char *argv[])
+{
+ ACE_TRY
+ {
+ // Initialize ORB.
+ CORBA::ORB_ptr orb =
+ CORBA::ORB_init (argc, argv, "internet", ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ CORBA::POA_ptr poa =
+ orb->POA_init(argc, argv, "POA");
+ if (poa == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+ }
+
+#if 0
+ CORBA::Object_ptr objref =
+ orb->resolve_initial_references ("NameService");
+ ACE_CHECK_ENV;
+
+ CosNaming::NamingContext_var naming_context =
+ CosNaming::NamingContext::_narrow (objref, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+#endif
+
+ // Create an Scheduling service servant...
+ RtecScheduler::Scheduler_ptr scheduler = new ACE_Config_Scheduler;
+ // CORBA::Object::_duplicate(scheduler);
+ ACE_CHECK_ENV;
+
+ CORBA::String str =
+ orb->object_to_string (scheduler, ACE_TRY_ENV);
+ ACE_OS::puts ((char *) str);
+
+#if 0
+ // Register the servant with the Naming Context....
+ CosNaming::Name schedule_name (1);
+ schedule_name[0].id = CORBA::string_dup ("ScheduleService");
+ schedule_name.length (1);
+ naming_context->bind (schedule_name, scheduler, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+#endif
+
+ ACE_DEBUG ((LM_DEBUG, "running scheduling service\n"));
+ if (orb->run () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run"), 1);
+ }
+
+ CORBA::release (scheduler);
+ }
+ ACE_CATCHANY
+ {
+ ACE_TRY_ENV.print_exception ("schedule_service");
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/local/bin/Scheduling_Service/svc.conf b/TAO/local/bin/Scheduling_Service/svc.conf
new file mode 100644
index 00000000000..43c6a486c92
--- /dev/null
+++ b/TAO/local/bin/Scheduling_Service/svc.conf
@@ -0,0 +1,49 @@
+# $Id$
+#
+# This file contains a sample ACE_Service_Config configuration
+# file specifying the strategy factories utilized by an application
+# using TAO. There are currently only two possible factories:
+# Client_Strategy_Factory and Server_Strategy_Factory. These names
+# must be used as the second argument to their corresponding line,
+# because that's what the ORB uses to find the desired factory.
+#
+# Note that there are two unordinary characteristics of the way *this*
+# file is set up:
+# - both client and server strategies are specified in the same
+# file, which would only make sense for co-located clients & servers
+# - both of the factories are actually sourced out of libTAO.so
+# (TAO.DLL on Win32), and they would normally be in a separate
+# dll from the TAO ORB Core.
+#
+# The options which can be passed to the Resource Factory are:
+#
+# -ORBresources <which>
+# where <which> can be 'global' to specify globally-held resources,
+# or 'tss' to specify thread-specific resources.
+#
+# The options which can be passed to the Client are:
+# <none currently>
+#
+# The options which can be passed to the Server are:
+#
+# -ORBconcurrency <which>
+# where <which> can be 'thread-per-connection' to specify
+# use of the ACE_Threaded_Strategy concurrency strategy,
+# or 'reactive' to specify use of the ACE_Reactive_Strategy
+# concurrency strategy.
+#
+# -ORBthreadflags <flags>
+# specifies the default thread flags to use, where <flags> is a
+# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP,
+# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid
+# on every platform.
+#
+# -ORBdemuxstrategy <which>
+# where <which> can be one of 'dynamic', 'linear', 'active', or 'user',
+# and specifies the type of object lookup strategy used internally.
+# -ORBtablesize <unsigned>
+# specifies the size of the object table
+#
+dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global"
+dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory()
+dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128"
diff --git a/TAO/local/tests/Latency.cpp b/TAO/local/tests/Latency.cpp
new file mode 100644
index 00000000000..e3ef94e9cd8
--- /dev/null
+++ b/TAO/local/tests/Latency.cpp
@@ -0,0 +1,756 @@
+// $Id$
+
+#include <limits.h>
+#if defined (quantify)
+ #include <quantify.h>
+#endif /* quantify */
+
+#include "ace/Get_Opt.h"
+#include "ace/Sched_Params.h"
+
+#include "Event_Utilities.h"
+#include "Event_Service_Constants.h"
+#include "Scheduler_Factory.h"
+#include "RtecEventChannelAdminC.h"
+#include "Latency.h"
+
+static const char usage [] = "[-? |\n"
+" [-c <consumers> [4]]\n"
+" [-d directly connect all consumers/suppliers\n"
+" [-j to collect jitter statistics]\n"
+" [-m <count> of messages to send [10]]\n"
+" [-s <suppliers>, [1]]\n"
+" [-t <timeout interval>, msec [250]]]";
+
+// Configuration parameters.
+static u_int consumers = 4;
+static u_int suppliers = 1;
+static u_int total_messages = 10;
+static int measure_jitter = 0;
+static u_int timeout_interval = 250; // msec
+
+static int short_circuit_EC = 0;
+static int shutting_down = 0;
+
+// This is global to allow the Supplier to short ciruit the EC
+// and talk directly to consumers. For testing only :-)
+static Latency_Consumer **consumer;
+
+// ************************************************************
+
+Latency_Consumer::Latency_Consumer (const int measure_jitter)
+ : measure_jitter_ (measure_jitter),
+ min_latency_ (INT_MAX),
+ max_latency_ (INT_MIN),
+ total_latency_ (0),
+ total_pushes_ (0)
+{
+}
+
+int
+Latency_Consumer::open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec,
+ const char *my_name)
+{
+ entry_point (my_name);
+ ACE_TRY
+ {
+ RtecScheduler::Scheduler_ptr server =
+ ACE_Scheduler_Factory::server ();
+
+ rt_info_ =
+ server->create (my_name, ACE_TRY_ENV);
+ server->set (rt_info_,
+ 1, 1, 1, 0,
+ RtecScheduler::VERY_LOW,
+ RtecScheduler::NO_QUANTUM, 1,
+ ACE_TRY_ENV);
+
+ // Create the event that we're registering for.
+ ACE_ConsumerQOS_Factory dependencies;
+ dependencies.start_disjunction_group ();
+ dependencies.insert_type (ACE_ES_EVENT_NOTIFICATION, rt_info_);
+ dependencies.insert_type (ACE_ES_EVENT_SHUTDOWN, rt_info_);
+
+ this->channel_admin_ = ec;
+
+ // = Connect as a consumer.
+ consumer_admin_ =
+ RtecEventChannelAdmin::ConsumerAdmin::_duplicate(channel_admin_->for_consumers (ACE_TRY_ENV));
+ ACE_CHECK_ENV;
+ suppliers_ =
+ RtecEventChannelAdmin::ProxyPushSupplier::_duplicate(consumer_admin_->obtain_push_supplier (ACE_TRY_ENV));
+ ACE_CHECK_ENV;
+ suppliers_->connect_push_consumer (this,
+ dependencies.get_ConsumerQOS (),
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCH (const ACE_EventChannel::SUBSCRIPTION_ERROR, se)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Latency_Consumer::open: "
+ "subscribe failed.\n"), -1);
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Latency_Consumer::open: "
+ "unexpected exception.\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+Latency_Consumer::disconnect_push_consumer (CORBA::Environment &)
+{
+ ACE_DEBUG ((LM_DEBUG, "Consumer received disconnect from channel.\n"));
+}
+
+void
+Latency_Consumer::push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &)
+{
+ // @@ ACE_TIMEPROBE ("push event to consumer");
+
+ #if defined (quantify)
+ // If measuring jitter, just Quantify the supplier-consumer path.
+ if (measure_jitter)
+ {
+ quantify_stop_recording_data ();
+ }
+ #endif /* quantify */
+
+ if (events[0].type_ == ACE_ES_EVENT_SHUTDOWN)
+ this->shutdown ();
+ else
+ {
+ if (measure_jitter_)
+ {
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ // Note: the division by 1 provides transparent support of
+ // ACE_U_LongLong.
+ ACE_Time_Value latency (now / 1000000000,
+ (now / 1 % 1000000000) / 1000);
+ latency -= ACE_Time_Value (events[0].time_ / 1000000000,
+ (events[0].time_ / 1 % 1000000000) / 1000);
+
+ if (! shutting_down)
+ {
+ if (min_latency_ > latency) min_latency_ = latency;
+ if (max_latency_ < latency) max_latency_ = latency;
+ total_latency_ += latency;
+ ++total_pushes_;
+ }
+ }
+
+ // @@ ACE_TIMEPROBE_PRINT;
+ }
+}
+
+void
+Latency_Consumer::shutdown (void)
+{
+ ACE_DEBUG ((LM_DEBUG, "(%t) %s shutting down.\n", entry_point ()));
+
+ ACE_TRY
+ {
+ // Disconnect from the push supplier.
+ suppliers_->disconnect_push_supplier (ACE_TRY_ENV);
+ CORBA::release (suppliers_);
+
+ // @@ TODO: Shutdown the ORB here (how to get an orb to call
+ // shutdown on it?)
+ // ACE_MT_CORBA_Handler::instance()->reactor()->end_event_loop();
+ ACE_DEBUG ((LM_DEBUG, "@@ we should shutdown here!!!\n"));
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%t) %s Latency_Consumer::shutdown: unexpected exception.\n",
+ entry_point ()));
+ }
+ ACE_ENDTRY;
+}
+
+
+void
+Latency_Consumer::print_stats () /* const */
+{
+ if (measure_jitter_)
+ {
+ ACE_DEBUG ((LM_TRACE,
+ "%s: minimum, maximum, average event latency (msec): "
+ "%5.3f, %5.3f, %5.3f\n",
+ entry_point (),
+ (min_latency_.sec () * 1000000.0 + min_latency_.usec ()) /
+ 1000.0,
+ (max_latency_.sec () * 1000000.0 + max_latency_.usec ()) /
+ 1000.0,
+ (total_latency_.sec () * 1000000.0 +
+ total_latency_.usec ()) / total_pushes_ / 1000.0));
+ }
+}
+
+
+// ************************************************************
+
+Latency_Supplier::Latency_Supplier (const u_int total_messages,
+ CORBA::Long supplier_id,
+ const int timestamp)
+ : total_messages_ (total_messages),
+ supplier_id_ (supplier_id),
+ timestamp_ (timestamp),
+ total_sent_ (0),
+ master_ (0)
+{
+}
+
+int
+Latency_Supplier::open_supplier (RtecEventChannelAdmin::EventChannel_ptr ec,
+ const char *name, int master)
+{
+ this->entry_point (name);
+ master_ = master;
+ ACE_TRY
+ {
+ RtecScheduler::Scheduler_ptr server =
+ ACE_Scheduler_Factory::server ();
+
+ rt_info_ =
+ server->create (name, ACE_TRY_ENV);
+
+ server->set (rt_info_, 1, 1, 1, timeout_interval * 10000,
+ RtecScheduler::VERY_LOW,
+ RtecScheduler::NO_QUANTUM, 1,
+ ACE_TRY_ENV);
+
+#if 0
+ SUPPLIER_NS::RegisterService
+ (entry_point (),
+ // ACE_Naming::NOBJECT,
+ NOBJECT, this);
+#endif /* 0 */
+
+ ACE_SupplierQOS_Factory publications;
+ publications.insert (supplier_id_,
+ ACE_ES_EVENT_NOTIFICATION,
+ rt_info_, 1);
+ publications.insert (supplier_id_,
+ ACE_ES_EVENT_SHUTDOWN,
+ rt_info_, 1);
+
+ this->channel_admin_ = ec;
+
+ // = Connect as a supplier.
+ supplier_admin_ =
+ RtecEventChannelAdmin::SupplierAdmin::_duplicate(channel_admin_->for_suppliers (ACE_TRY_ENV));
+ ACE_CHECK_ENV;
+ consumers_ =
+ RtecEventChannelAdmin::ProxyPushConsumer::_duplicate(supplier_admin_->obtain_push_consumer (ACE_TRY_ENV));
+ ACE_CHECK_ENV;
+
+ consumers_->connect_push_supplier (this,
+ publications.get_SupplierQOS (),
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCH (const ACE_EventChannel::SUBSCRIPTION_ERROR, se)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Latency_Supplier::open: subscribe failed.\n"), -1);
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Latency_Supplier::open: unexpected exception.\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+Latency_Supplier::disconnect_push_consumer (CORBA::Environment &)
+{
+ ACE_DEBUG ((LM_DEBUG, "Supplier-consumer received disconnect from channel.\n"));
+}
+
+void
+Latency_Supplier::disconnect_push_supplier (CORBA::Environment &)
+{
+ ACE_DEBUG ((LM_DEBUG, "Supplier received disconnect from channel.\n"));
+}
+
+int
+Latency_Supplier::start_generating_events (void)
+{
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ test_start_time_.set (now / 1000000000, (now / 1 % 1000000000) / 1000);
+
+ ACE_TRY
+ {
+ ACE_ConsumerQOS_Factory dependencies;
+ dependencies.start_disjunction_group ();
+ dependencies.insert (ACE_ES_EVENT_INTERVAL_TIMEOUT,
+ timeout_interval * 10000,
+ rt_info_);
+ if (!master_)
+ dependencies.insert_type (ACE_ES_EVENT_SHUTDOWN, rt_info_);
+
+ // = Connect as a consumer.
+ consumer_admin_ =
+ RtecEventChannelAdmin::ConsumerAdmin::_duplicate(channel_admin_->for_consumers (ACE_TRY_ENV));
+ ACE_CHECK_ENV;
+ suppliers_ =
+ RtecEventChannelAdmin::ProxyPushSupplier::_duplicate(consumer_admin_->obtain_push_supplier (ACE_TRY_ENV));
+ ACE_CHECK_ENV;
+
+ suppliers_->connect_push_consumer (this,
+ dependencies.get_ConsumerQOS (),
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Latency_Supplier::generate_events:"
+ " unexpected exception.\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+Latency_Supplier::push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &)
+{
+ if (!master_ && events[0].type_ == ACE_ES_EVENT_SHUTDOWN)
+ this->shutdown ();
+ else if (events[0].type_ == ACE_ES_EVENT_INTERVAL_TIMEOUT)
+ {
+ // Create the event to send.
+ RtecEventComm::Event event;
+ // TODO: Set the SOURCE ID event.source_ = this;
+ event.type_ = ACE_ES_EVENT_NOTIFICATION;
+ ++total_sent_;
+
+ if (timestamp_)
+ {
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ // David, time_ is now a long. I'm not sure if this calculation correct now.
+ //event.time_.set (now / 1000000000, (now % 1000000000) / 1000);
+ event.time_ = now;
+ }
+
+ // @@ ACE_TIMEPROBE_RESET;
+ // @@ ACE_TIMEPROBE ("start with new event in Supplier");
+
+ ACE_TRY
+ {
+ if (short_circuit_EC)
+ {
+ for (u_int cons = 0; cons < consumers; ++cons)
+ {
+ // This constructor is fast.
+ const RtecEventComm::EventSet es (1, 1, &event);
+ consumer [cons]->push (es, ACE_TRY_ENV);
+ }
+ }
+ else
+ {
+#if defined (quantify)
+ // If measuring jitter, just Quantify the supplier-consumer path.
+ if (measure_jitter)
+ {
+ quantify_start_recording_data ();
+ }
+#endif /* quantify */
+
+ // @@ ACE_TIMEPROBE ("time to read high-res clock and "
+ // @@ "compare an int with 0");
+ RtecEventComm::EventSet events (1);
+ events.length (1);
+ events[0] = event;
+ consumers_->push (events, ACE_TRY_ENV);
+ }
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCH (RtecEventComm::Disconnected, d)
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) Latency_Supplier::push: disconnected.\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) %s Latency_Supplier::push:"
+ " unexpected exception.\n",
+ entry_point ()));
+ }
+ ACE_ENDTRY;
+
+ // Check if we're done.
+ if (master_ && (total_sent_ >= total_messages_))
+ this->shutdown ();
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) %s received unexpected events: ",
+ entry_point ()));
+ // ::dump_sequence (events);
+ return;
+ }
+}
+
+void
+Latency_Supplier::shutdown (void)
+{
+ shutting_down = 1;
+
+ #if defined (quantify)
+ // Need to stop recording here even if testing for jitter, because
+ // recording is still probably enabled.
+ quantify_stop_recording_data ();
+ if (! measure_jitter)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) stopped Quantify recording\n"));
+ }
+ #endif /* quantify */
+
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ test_stop_time_.set (now / 1000000000, (now / 1 % 1000000000) / 1000);
+
+ static int total_iterations = 1;
+ if (--total_iterations > 0)
+ {
+ total_sent_ = 0;
+ return;
+ }
+
+ ACE_TRY
+ {
+ if (master_)
+ {
+ // Create the shutdown message.
+ RtecEventComm::Event event;
+ // TODO: Set the EVENT SOURCE event.source_ = this;
+ event.type_ = ACE_ES_EVENT_SHUTDOWN;
+
+ // Push the shutdown event.
+ RtecEventComm::EventSet events (1);
+ events.length (1);
+ events[0] = event;
+ consumers_->push (events, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+
+ // Disconnect from the channel.
+ consumers_->disconnect_push_consumer (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ // Disconnect from the push supplier.
+ suppliers_->disconnect_push_supplier (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ if (master_)
+ channel_admin_->destroy (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) %s Latency_Supplier::shutdown:"
+ " unexpected exception.\n",
+ entry_point ()));
+ }
+ ACE_ENDTRY;
+}
+
+
+void
+Latency_Supplier::print_stats () /* const */
+{
+ ACE_Time_Value test_elapsed_time (test_stop_time_ - test_start_time_);
+ const u_int elapsed = test_elapsed_time.sec () * 1000000 +
+ test_elapsed_time.usec (); // usec
+
+ ACE_DEBUG ((LM_TRACE,
+ "%s: delivered %u events to %u consumer(s) in %u msec;\n"
+ " per-event average was %8.3f msec.\n",
+ entry_point (),
+ total_sent_,
+ consumers / suppliers + consumers % suppliers,
+ elapsed / 1000,
+ (double) elapsed / total_sent_ / 1000.0));
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// function get_options
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+static
+unsigned int
+get_options (int argc, char *argv [])
+{
+ ACE_Get_Opt get_opt (argc, argv, "Oc:djm:s:t:?");
+ int opt;
+ int temp;
+
+ while ((opt = get_opt ()) != EOF)
+ {
+ switch (opt) {
+ case 'c':
+ if ((temp = ACE_OS::atoi (get_opt.optarg)) > 0)
+ {
+ consumers = (u_int) temp;
+ }
+ else
+ {
+ cerr << argv [0] << ": number of consumers must be > 0" << endl;
+ return 1;
+ }
+ break;
+ case 'd':
+ short_circuit_EC = 1;
+ break;
+ case 'j':
+ measure_jitter = 1;
+ break;
+ case 'm':
+ if ((temp = ACE_OS::atoi (get_opt.optarg)) > 0)
+ {
+ total_messages = (u_int) temp;
+ }
+ else
+ {
+ cerr << argv [0] << ": count must be > 0" << endl;
+ return 1;
+ }
+ break;
+ case 's':
+ if ((temp = ACE_OS::atoi (get_opt.optarg)) > 0)
+ {
+ suppliers = (u_int) temp;
+ }
+ else
+ {
+ cerr << argv [0] << ": number of suppliers must be > 0" << endl;
+ return 1;
+ }
+ break;
+ case 't':
+ if (ACE_OS::atoi (get_opt.optarg) >= 0)
+ {
+ timeout_interval = ACE_OS::atoi (get_opt.optarg);
+ }
+ else
+ {
+ cerr << argv [0] << ": count must be >= 0" << endl;
+ return 1;
+ }
+ break;
+ case 'O':
+ // Ignore -O options those are used by the ORB....
+ break;
+ case '?':
+ cout << "usage: " << argv [0] << " " << usage << endl;
+ ACE_OS::exit (0);
+ break;
+ default:
+ cerr << argv [0] << ": unknown arg, " << (char) opt << endl;
+ cerr << "usage: " << argv [0] << " " << usage << endl;
+ return 1;
+ }
+ }
+
+ switch (argc - get_opt.optind) {
+ case 0:
+ // OK
+ break;
+ default:
+ cerr << argv [0] << ": too many arguments" << endl;
+ cerr << "usage: " << argv [0] << " " << usage << endl;
+ return 1;
+ }
+
+ return 0;
+}
+
+#if 0
+// ************************************************************
+// This function tells the scheduler to generate a schedule. It will
+// only call it once, so this function can be called multiple times.
+static void
+Generate_Schedule (void)
+{
+ static int once = 0;
+ static ACE_Thread_Mutex m;
+
+ if (once == 0)
+ {
+ ACE_Guard<ACE_Thread_Mutex> ace_mon (m);
+
+ // Double-check.
+ if (once == 0)
+ {
+ once = 1;
+ ACE_Scheduler::status_t result = ACE_Scheduler::instance ().schedule ();
+
+ if (result != ACE_Scheduler::SUCCEEDED)
+ ACE_ERROR ((LM_ERROR, "ACE_Scheduler::schedule failed.\n"));
+ else
+ {
+ if (Scheduler_Runtime::config ())
+ {
+ ACE_DEBUG ((LM_ERROR, "ACE_Scheduler::schedule succeeded.\n"));
+ }
+ }
+ }
+ }
+}
+#endif /* 0 */
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// function main
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+int
+main (int argc, char *argv [])
+{
+ if (ACE_OS::sched_params (
+ ACE_Sched_Params (
+ ACE_SCHED_FIFO,
+ ACE_Sched_Params::priority_min (ACE_SCHED_FIFO),
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_MAX, "Latency: user is not superuser, "
+ "so remain in time-sharing class\n"));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_ERROR, "%p\n", "Latency"));
+ ACE_OS::exit (-1);
+ }
+ }
+
+ u_int i;
+
+ ACE_TRY
+ {
+ // Initialize ORB.
+ CORBA::ORB_ptr orb =
+ CORBA::ORB_init (argc, argv, "internet", ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ CORBA::POA_ptr poa =
+ orb->POA_init(argc, argv, "POA");
+
+ // if (get_options (argc, argv))
+ // ACE_OS::exit (-1);
+
+
+
+#if 0
+ CORBA::Object_ptr objref =
+ orb->resolve_initial_references ("NameService");
+ ACE_CHECK_ENV;
+ CosNaming::NamingContext_var naming_context =
+ CosNaming::NamingContext::_narrow (objref, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ ACE_Scheduler_Factory::use_config (naming_context);
+#else
+ ACE_Scheduler_Factory::use_config (orb);
+#endif /* 0 */
+
+ // Allocate the timeprobe instance now, so we don't measure
+ // the cost of doing it later.
+ // @@ ACE_TIMEPROBE_RESET;
+
+ RtecEventChannelAdmin::EventChannel_var ec =
+ RtecEventChannelAdmin::EventChannel::_narrow
+ (orb->resolve_initial_references ("EventService"),
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ // Create supplier(s).
+ Latency_Supplier **supplier;
+ ACE_NEW_RETURN (supplier, Latency_Supplier *[suppliers], -1);
+ for (i = 0; i < suppliers; ++i)
+ {
+ ACE_NEW_RETURN (supplier [i],
+ Latency_Supplier (total_messages, measure_jitter),
+ -1);
+ RtecEventComm::PushSupplier::_duplicate (supplier[i]);
+ char supplier_name [BUFSIZ];
+ sprintf (supplier_name, "supplier-%d", i+1);
+ if (supplier [i]->open_supplier (ec,
+ supplier_name,
+ int (i == 0)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "Supplier open failed.\n"), -1);
+ }
+
+ // Create consumers.
+ ACE_NEW_RETURN (consumer, Latency_Consumer *[consumers], -1);
+ for (i = 0; i < consumers; ++i)
+ {
+ ACE_NEW_RETURN (consumer [i], Latency_Consumer (measure_jitter), -1);
+ RtecEventComm::PushConsumer::_duplicate (consumer[i]);
+ char buf [BUFSIZ];
+ sprintf (buf, "consumer-%d", i+1);
+
+ if (consumer [i]->open_consumer (ec, buf) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "Someone was feeling introverted.\n"),
+ -1);
+ }
+
+ #if defined (quantify)
+ if (! measure_jitter)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) start Quantify recording\n"));
+ quantify_start_recording_data ();
+ }
+ #endif /* quantify */
+
+ // Tell supplier(s) to generate events.
+ for (i = 0; i < suppliers; ++i)
+ {
+ if (supplier [i]->start_generating_events () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "generate_events failed.\n"), -1);
+ }
+
+ orb->run ();
+
+ for (i = 0; i < suppliers; ++i)
+ {
+ supplier [i]->print_stats ();
+ CORBA::release (supplier [i]);
+ ACE_CHECK_ENV;
+ }
+ delete [] supplier;
+
+ for (i = 0; i < consumers; ++i)
+ {
+ consumer [i]->print_stats ();
+ CORBA::release (consumer [i]);
+ ACE_CHECK_ENV;
+ }
+ delete [] consumer;
+
+ // @@ ACE_TIMEPROBE_FINI;
+ }
+ ACE_CATCH (CORBA::SystemException, sys_ex)
+ {
+ ACE_TRY_ENV.print_exception ("SYS_EX");
+ }
+ ACE_ENDTRY;
+
+
+ return 0;
+}
diff --git a/TAO/local/tests/Latency.h b/TAO/local/tests/Latency.h
new file mode 100644
index 00000000000..7518ec0ad4e
--- /dev/null
+++ b/TAO/local/tests/Latency.h
@@ -0,0 +1,191 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ACE Event Service Benchmarks
+//
+// = FILENAME
+// Latency.h
+//
+// = AUTHOR
+// David Levine (levine@cs.wustl.edu) and
+// Tim Harrison (harrison@cs.wustl.edu)
+//
+// = DESCRIPTION
+//
+// ============================================================================
+
+#if !defined (LATENCY_H)
+#define LATENCY_H
+
+#include "ace/SString.h"
+#include "RtecEventChannelAdminC.h"
+#include "RtecEventCommS.h"
+
+class Latency_Consumer : public POA_RtecEventComm::PushConsumer
+// = TITLE
+// Latency Consumer
+//
+// = DESCRIPTION
+// Simple example of a consumer that registers for supplier
+// notifications.
+{
+public:
+ Latency_Consumer (const int measure_jitter = 0);
+ // Construction. The default of not measuring jitter provides
+ // a "null" push routine, for measuring aggregate timing.
+
+ int open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec,
+ const char *my_name);
+ // Uses the name server to obtain a reference to the <supplier_name>
+ // and registers with channel to receive notifications from the
+ // supplier. Also registers to receive shutdown messages from the
+ // supplier. Stores <my_name> for printing out messages. Returns 0
+ // on success, -1 on failure.
+
+ virtual void disconnect_push_consumer (CORBA::Environment &);
+ // The channel is disconnecting.
+
+ void entry_point (const char*);
+ const char *entry_point () const;
+
+ void print_stats () /* const */;
+ // Print timing statistics.
+
+// (not protected to allow short-circuiting) protected:
+ virtual void push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &);
+ // If the <events>[0] is a notification, prints out the data from
+ // the supplier. If its a shutdown message, the consumer
+ // disconnects from the channel.
+
+protected:
+ void shutdown (void);
+ // Disconnect from the Event Service.
+
+ // = Event channel adminstration references.
+ RtecEventChannelAdmin::EventChannel_var channel_admin_;
+ RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin_;
+ RtecEventChannelAdmin::ProxyPushSupplier_ptr suppliers_;
+
+private:
+ RtecScheduler::handle_t rt_info_;
+
+ int measure_jitter_;
+
+ ACE_Time_Value min_latency_;
+ ACE_Time_Value max_latency_;
+ ACE_Time_Value total_latency_;
+ u_long total_pushes_;
+ // Registers and counters for keeping track of latency statistics.
+
+ ACE_CString entry_point_;
+};
+
+// ************************************************************
+
+class Latency_Supplier : public POA_RtecEventComm::PushSupplier, public POA_RtecEventComm::PushConsumer
+// = TITLE
+// Latency Supplier
+//
+// = DESCRIPTION
+// Generates event nofications and a shutdown message.
+{
+public:
+ Latency_Supplier (const u_int total_messages,
+ CORBA::Long supplier_id,
+ const int timestamp = 0);
+ // Construction. Requires the total number of messages to be
+ // sent. If the timestamp flag is enabled, then events are
+ // timestamped, e.g., for use in measuring jitter.
+
+ int open_supplier (RtecEventChannelAdmin::EventChannel_ptr event_channel,
+ const char *name, int master);
+ // Registers with the name server under the given <name>. Also
+ // connects to the Event Channel as a supplier of notifications and
+ // shutdown messages. If <master> != 0, then the supplier will
+ // destroy the channel upon shutting down. Returns 0 on success, -1
+ // on failure.
+
+ virtual void disconnect_push_supplier (CORBA::Environment &);
+ // The channel is disconnecting.
+
+ virtual void disconnect_push_consumer (CORBA::Environment &);
+ // The channel is disconnecting.
+
+ int start_generating_events (void);
+ // Called when the supplier should start generating events.
+ // Registers with the Event Channel to receive timeouts every .25
+ // seconds. Will generate some number of events and then send a
+ // shutdown message. Returns 0 on success, -1 on failure.
+
+ void entry_point (const char *);
+ const char *entry_point () const;
+
+ void print_stats () /* const */;
+ // Print timing statistics.
+
+protected:
+ void push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &);
+ // Takes a timestamp and then pushes event_ to all consumers, either
+ // directly, or via a channel.
+
+ void shutdown (void);
+ // Disconnect from the Event Service.
+
+ // = Event Channel adminstration references.
+ RtecEventChannelAdmin::EventChannel_var channel_admin_;
+ RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ RtecEventChannelAdmin::ProxyPushConsumer_var consumers_;
+ RtecEventChannelAdmin::SupplierAdmin_var supplier_admin_;
+ RtecEventChannelAdmin::ProxyPushSupplier_var suppliers_;
+
+private:
+ RtecScheduler::handle_t rt_info_;
+
+ u_int total_messages_;
+ // How many events to push before ending the test.
+
+ CORBA::Long supplier_id_;
+ // Our supplier ID.
+
+ int timestamp_;
+ // Flag indicating whether or not to timestamp outgoing events.
+
+ u_int total_sent_;
+ // How many events we've pushed.
+
+ ACE_Time_Value test_start_time_;
+ ACE_Time_Value test_stop_time_;
+ // Start/stop times, marking the time period when events are
+ // sent to consumers.
+
+ int master_;
+
+ ACE_CString entry_point_;
+};
+
+void Latency_Consumer::entry_point(const char* s)
+{
+ entry_point_ = s;
+}
+
+const char* Latency_Consumer::entry_point (void) const
+{
+ return entry_point_.fast_rep ();
+}
+
+void Latency_Supplier::entry_point(const char* s)
+{
+ entry_point_ = s;
+}
+
+const char* Latency_Supplier::entry_point (void) const
+{
+ return entry_point_.fast_rep ();
+}
+
+#endif /* LATENCY_H */
diff --git a/TAO/local/tests/Makefile b/TAO/local/tests/Makefile
new file mode 100644
index 00000000000..dc0bdba09a9
--- /dev/null
+++ b/TAO/local/tests/Makefile
@@ -0,0 +1,262 @@
+#
+# $Id$
+#
+
+BIN = Latency # This is not compiling (yet) Utilization
+
+BUILD = $(BIN)
+
+LATENCY_SRCS= \
+ Latency.cpp
+UTILIZATION_SRCS= \
+ Utilization.cpp
+
+LSRC= \
+ $(LATENCY_SRCS) \
+ $(UTILIZATION_SRCS)
+
+LATENCY_OBJS = $(LATENCY_SRCS:.cpp=.o)
+UTILIZATION_OBJS = $(UTILIZATION_SRCS:.cpp=.o)
+
+LDLIBS= -lorbsvcs -lTAO
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#### compiler-specific options
+ifeq ($(CXX),g++)
+ CCFLAGS += -pedantic
+else
+ifeq ($(CXX),CC)
+endif
+endif
+
+ifdef quantify
+ CCFLAGS += -Dquantify
+ CPPFLAGS += -I/pkg/purify/quantify-2.1-solaris2
+endif # quantify
+
+#### Local rules and variables...
+
+ifndef TAO_ROOT
+TAO_ROOT = $(ACE_ROOT)/TAO
+endif
+TSS_ORB_FLAG = #-DTAO_HAS_TSS_ORBCORE
+DCFLAGS = -g
+LDFLAGS += -L$(TAO_ROOT)/orbsvcs/lib -L$(TAO_ROOT)/tao
+CPPFLAGS += -I$(TAO_ROOT)/orbsvcs/lib -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat $(TSS_ORB_FLAG)#-H
+
+# Leave the scheduler output out if this is a config run.
+ifneq ($(config),1)
+LATENCY_CONFIG_OBJS=Latency_Scheduler_Runtime.o
+UTILIZATION_CONFIG_OBJS=Latency_UTILIZATION_Runtime.o
+endif # config
+
+ifeq ($(probe),1)
+ CCFLAGS += -DACE_ENABLE_TIMEPROBES
+endif # probe
+
+Latency: $(addprefix $(VDIR),$(LATENCY_OBJS) $(LATENCY_CONFIG_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+Utilization: $(addprefix $(VDIR),$(UTILIZATION_OBJS) $(UTILIZATION_CONFIG_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS)
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/Latency.o .shobj/Latency.: Latency.cpp \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/stdcpp.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/Sched_Params.h \
+ $(ACE_ROOT)/ace/Sched_Params.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Utilities.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/orb.h \
+ $(TAO_ROOT)/tao/corbacom.h \
+ $(TAO_ROOT)/tao/object.h \
+ $(TAO_ROOT)/tao/align.h \
+ $(TAO_ROOT)/tao/sequence.h \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/any.h \
+ $(TAO_ROOT)/tao/poa.h \
+ $(TAO_ROOT)/tao/tao_internals.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/client_factory.h \
+ $(TAO_ROOT)/tao/server_factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/except.h \
+ $(TAO_ROOT)/tao/orbobj.h \
+ $(TAO_ROOT)/tao/nvlist.h \
+ $(TAO_ROOT)/tao/principa.h \
+ $(TAO_ROOT)/tao/request.h \
+ $(TAO_ROOT)/tao/svrrqst.h \
+ $(TAO_ROOT)/tao/typecode.h \
+ $(TAO_ROOT)/tao/marshal.h \
+ $(TAO_ROOT)/tao/cdr.h \
+ $(TAO_ROOT)/tao/stub.h \
+ $(TAO_ROOT)/tao/connect.h \
+ $(TAO_ROOT)/tao/orb_core.h \
+ $(TAO_ROOT)/tao/objtable.h \
+ $(TAO_ROOT)/tao/optable.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/managed_types.h \
+ $(TAO_ROOT)/tao/iiopobj.h \
+ $(TAO_ROOT)/tao/iioporb.h \
+ $(TAO_ROOT)/tao/giop.h \
+ $(TAO_ROOT)/tao/orb_core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/corbacom.i \
+ $(TAO_ROOT)/tao/sequence.i \
+ $(TAO_ROOT)/tao/typecode.i \
+ $(TAO_ROOT)/tao/any.i \
+ $(TAO_ROOT)/tao/cdr.i \
+ $(TAO_ROOT)/tao/stub.i \
+ $(TAO_ROOT)/tao/object.i \
+ $(TAO_ROOT)/tao/orbobj.i \
+ $(TAO_ROOT)/tao/marshal.i \
+ $(TAO_ROOT)/tao/poa.i \
+ $(TAO_ROOT)/tao/giop.i \
+ $(TAO_ROOT)/tao/iioporb.i \
+ $(TAO_ROOT)/tao/iiopobj.i \
+ $(TAO_ROOT)/tao/managed_types.i \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/server_factory.i \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/connect.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecSchedulerC.i \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventChannelAdminC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Service_Constants.h \
+ $(TAO_ROOT)/orbsvcs/lib/Event_Utilities.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/lib/CosNamingC.i \
+ $(TAO_ROOT)/orbsvcs/lib/Scheduler_Factory.i \
+ Latency.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.h \
+ $(TAO_ROOT)/orbsvcs/lib/RtecEventCommS.i
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/local/tests/Utilization.cpp b/TAO/local/tests/Utilization.cpp
new file mode 100644
index 00000000000..0b99257d5b4
--- /dev/null
+++ b/TAO/local/tests/Utilization.cpp
@@ -0,0 +1,871 @@
+// $Id$
+
+#if defined (quantify)
+ #include <quantify.h>
+#endif /* quantify */
+#include <limits.h>
+
+#include "ace/Get_Opt.h"
+#include "ace/Sched_Params.h"
+
+#include "Event_Service_Constants.h"
+#include "Event_Utilities.h"
+#include "Utilization.h"
+
+static const char usage [] = "[-? |\n"
+ " [-c <consumers> [1]]\n"
+ " [-d directly connect all consumers/suppliers\n"
+ " [-j to collect jitter statistics]\n"
+ " [-m <count> of messages to send [10]]\n"
+ " [-s <suppliers>, [1]]\n"
+ " [-t <timeout interval>, msec [100]]]";
+
+// Configuration parameters.
+static u_int consumers = 1;
+static u_int suppliers = 1;
+static u_int total_messages = 10;
+static int measure_jitter = 0;
+static u_int timeout_interval = 100; // msec
+
+static int short_circuit_EC = 0;
+static int shutting_down = 0;
+
+// This is global to allow the Supplier to short ciruit the EC
+// and talk directly to consumers. For testing only :-)
+static Utilization_Consumer **consumer;
+
+// Hold the Scavenger up until we're ready to run . . .
+ACE_Barrier start_scavenger (2);
+u_int started_scavenger = 0;
+
+// ************************************************************
+
+Utilization_Consumer::Utilization_Consumer (const int measure_jitter)
+ : measure_jitter_ (measure_jitter),
+ iterations_ (0),
+ min_utilization_ (INT_MAX),
+ max_utilization_ (INT_MIN),
+ total_utilization_ (0),
+ total_pushes_ (0)
+{
+}
+
+int
+Utilization_Consumer::open_consumer (const char *my_name, const char *)
+{
+ // We look up name for our qos requirements.
+ ACE_Scheduler::status_t result =
+ ACE_Scheduler::instance ().get_rt_info (my_name, rt_info_);
+
+ switch (result)
+ {
+ case ACE_Scheduler::SUCCEEDED :
+ // Found.
+ break;
+
+ case ACE_Scheduler::UNKNOWN_TASK :
+ rt_info_->set ((timeout_interval - 1) * 10000 /* 100 ns/msec */,
+ (timeout_interval - 1) * 10000 /* 100 ns/msec */,
+ (timeout_interval - 1) * 10000 /* 100 ns/msec */,
+ 0);
+
+ // Not found, but created. We'll leave it blank for now.
+ break;
+
+ case ACE_Scheduler::FAILED :
+ default :
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR, "Utilization_Consumer: get_rt_info failed.\n"), -1);
+ }
+
+ ACE_TRY
+ {
+ // Look up the event service in the name server.
+ channel_admin_ = EVENT_CHANNEL_NS::BindService ("Event Service");
+ if (channel_admin_ == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "%p bind failed.\n", "Utilization_Consumer::open"));
+ return -1;
+ }
+
+ // Create the event that we're registering for.
+ ACE_ConsumerQOS_Factory dependencies;
+ dependencies.start_disjunction_group ();
+ dependencies.insert (ACE_ES_EVENT_NOTIFICATION, rt_info_);
+ dependencies.insert (ACE_ES_EVENT_SHUTDOWN, rt_info_);
+
+ // = Connect as a consumer.
+ consumer_admin_ = channel_admin_->for_consumers (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ suppliers_ = consumer_admin_->obtain_push_supplier (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ suppliers_->connect_push_consumer (this,
+ dependencies.get_ConsumerQOS (),
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCH (const ACE_EventChannel::SUBSCRIPTION_ERROR, se)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Utilization_Consumer::open: subscribe failed.\n"), -1);
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Utilization_Consumer::open: unexpected exception.\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+Utilization_Consumer::disconnect_push_consumer (CORBA::Environment &)
+{
+ ACE_DEBUG ((LM_DEBUG, "Consumer received disconnect from channel.\n"));
+}
+
+void
+Utilization_Consumer::push (const CosEventComm::EventSet &events,
+ CORBA::Environment &)
+{
+ ACE_TIMEPROBE ("push event to consumer");
+
+ #if defined (quantify)
+ // If measuring jitter, just Quantify the supplier-consumer path.
+ if (measure_jitter)
+ {
+ quantify_stop_recording_data ();
+ }
+ #endif /* quantify */
+
+ if (events[0].type_ == ACE_ES_EVENT_SHUTDOWN)
+ this->shutdown ();
+ else
+ {
+ if (measure_jitter_)
+ {
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ // Note: the division by 1 provides transparent support of
+ // ACE_U_LongLong.
+ ACE_Time_Value utilization (now / 1000000000,
+ (now / 1 % 1000000000) / 1000);
+ utilization -= ACE_Time_Value (events[0].time_ / 1000000000,
+ (events[0].time_ / 1 % 1000000000) / 1000);
+
+ if (! shutting_down)
+ {
+ if (min_utilization_ > utilization) min_utilization_ = utilization;
+ if (max_utilization_ < utilization) max_utilization_ = utilization;
+ total_utilization_ += utilization;
+ ++total_pushes_;
+ }
+ }
+
+ ACE_TIMEPROBE_PRINT;
+
+ // Chew up almost the entire timeout interval on the CPU.
+ u_long n = 1279ul; /* takes about 40.2 usecs on a 167 MHz Ultra2 */
+
+ for (u_int i = 0; i < (timeout_interval * 1000 / 40.2); ++i)
+ {
+ ACE::is_prime (n,
+ 2ul /* min_factor */,
+ n/2 /* max_factor */);
+ iterations_ += 1; // ACE_U_LongLong doesn't have ++
+ }
+ }
+}
+
+void
+Utilization_Consumer::shutdown (void)
+{
+ ACE_DEBUG ((LM_DEBUG, "(%t) %s shutting down.\n", entry_point ()));
+
+ ACE_TRY
+ {
+ // Disconnect from the push supplier.
+ suppliers_->disconnect_push_supplier (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%t) %s Utilization_Consumer::shutdown: unexpected exception.\n",
+ entry_point ()));
+ }
+ ACE_ENDTRY;
+}
+
+
+void
+Utilization_Consumer::print_stats () /* const */
+{
+ if (measure_jitter_)
+ {
+ ACE_DEBUG ((LM_TRACE,
+ "%s: minimum, maximum, average event utilization (msec): "
+ "%5.3f, %5.3f, %5.3f\n",
+ entry_point (),
+ (min_utilization_.sec () * 1000000.0 + min_utilization_.usec ()) /
+ 1000.0,
+ (max_utilization_.sec () * 1000000.0 + max_utilization_.usec ()) /
+ 1000.0,
+ (total_utilization_.sec () * 1000000.0 +
+ total_utilization_.usec ()) / total_pushes_ / 1000.0));
+ }
+ ACE_OS::fprintf (stderr, "Consumer processed %llu iterations\n",
+ iterations_ / 1ul);
+}
+
+
+// ************************************************************
+
+Utilization_Supplier::Utilization_Supplier (const u_int total_messages,
+ const int timestamp)
+ : total_messages_ (total_messages),
+ timestamp_ (timestamp),
+ total_sent_ (0),
+ master_ (0)
+{
+}
+
+int
+Utilization_Supplier::open_supplier (const char *name, int master)
+{
+ master_ = master;
+
+ // We look up name for our qos requirements.
+ ACE_Scheduler::status_t result =
+ ACE_Scheduler::instance ().get_rt_info (name, rt_info_);
+
+ switch (result)
+ {
+ case ACE_Scheduler::SUCCEEDED :
+ // Found.
+ break;
+
+ case ACE_Scheduler::UNKNOWN_TASK :
+ // Not found, but created. We want to be notified 4 times a second.
+ rt_info_->set (1,1,1, timeout_interval * 10000 /* 100 ns/msec */,
+ ACE_Scheduler::RT_Info::VERY_LOW,
+ ACE_Scheduler::RT_Info::NO_QUANTUM);
+ break;
+
+ case ACE_Scheduler::FAILED :
+ default :
+ // Error.
+ ACE_ERROR_RETURN ((LM_ERROR, "Utilization_Supplier: get_rt_info failed.\n"), -1);
+ }
+
+ ACE_TRY
+ {
+ SUPPLIER_NS::RegisterService
+ (entry_point (),
+ // ACE_Naming::NOBJECT,
+ NOBJECT, this);
+
+ // Look up the event service in the name server.
+ channel_admin_ = EVENT_CHANNEL_NS::BindService ("Event Service");
+ if (channel_admin_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p bind failed.\n",
+ "Utilization_Supplier::open"), -1);
+
+ ACE_SupplierQOS_Factory publications;
+ publications.insert (ACE_ES_EVENT_NOTIFICATION, rt_info_, 1);
+ publications.insert (ACE_ES_EVENT_SHUTDOWN, rt_info_, 1);
+
+ // = Connect as a supplier.
+ supplier_admin_ = channel_admin_->for_suppliers (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ consumers_ = supplier_admin_->obtain_push_consumer (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ consumers_->connect_push_supplier (this,
+ publications.get_SupplierQOS (),
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCH (const ACE_EventChannel::SUBSCRIPTION_ERROR, se)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Utilization_Supplier::open: subscribe failed.\n"), -1);
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Utilization_Supplier::open: unexpected exception.\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+Utilization_Supplier::disconnect_push_consumer (CORBA::Environment &)
+{
+ ACE_DEBUG ((LM_DEBUG, "Supplier-consumer received disconnect from channel.\n"));
+}
+
+void
+Utilization_Supplier::disconnect_push_supplier (CORBA::Environment &)
+{
+ ACE_DEBUG ((LM_DEBUG, "Supplier received disconnect from channel.\n"));
+}
+
+int
+Utilization_Supplier::start_generating_events (void)
+{
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ test_start_time_.set (now / 1000000000, (now / 1 % 1000000000) / 1000);
+
+ ACE_TRY
+ {
+ ACE_ConsumerQOS_Factory dependencies;
+ dependencies.start_disjunction_group ();
+ dependencies.insert (ACE_ES_EVENT_INTERVAL_TIMEOUT,
+ timeout_interval * 10000 /* 100 ns/msec */,
+ rt_info_);
+ if (!master_)
+ dependencies.insert (ACE_ES_EVENT_SHUTDOWN, rt_info_);
+
+ // = Connect as a consumer.
+ consumer_admin_ = channel_admin_->for_consumers (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ suppliers_ = consumer_admin_->obtain_push_supplier (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ suppliers_->connect_push_consumer (this,
+ dependencies.get_ConsumerQOS (),
+ ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Utilization_Supplier::generate_events:"
+ " unexpected exception.\n"), -1);
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+Utilization_Supplier::push (const CosEventComm::EventSet &events,
+ CORBA::Environment &)
+{
+ if (!master_ && events[0].type_ == ACE_ES_EVENT_SHUTDOWN)
+ this->shutdown ();
+ else if (events[0].type_ == ACE_ES_EVENT_INTERVAL_TIMEOUT)
+ {
+ // Create the event to send.
+ CosEventComm::Event event;
+ event.source_ = this;
+ event.type_ = ACE_ES_EVENT_NOTIFICATION;
+ ++total_sent_;
+
+ if ( ! started_scavenger )
+ {
+ started_scavenger = 1;
+
+ // Start the Scavenger.
+ start_scavenger.wait ();
+ }
+
+ if (timestamp_)
+ {
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ // David, time_ is now a long. I'm not sure if this calculation correct now.
+ //event.time_.set (now / 1000000000, (now % 1000000000) / 1000);
+ event.time_ = now;
+ }
+
+ ACE_TIMEPROBE_RESET;
+ ACE_TIMEPROBE ("start with new event in Supplier");
+
+ ACE_TRY
+ {
+ if (short_circuit_EC)
+ {
+ for (u_int cons = 0; cons < consumers; ++cons)
+ {
+ // This constructor is fast.
+ const CosEventComm::EventSet es (1, 1, &event);
+ consumer [cons]->push (es, ACE_TRY_ENV);
+ }
+ }
+ else
+ {
+#if defined (quantify)
+ // If measuring jitter, just Quantify the supplier-consumer path.
+ if (measure_jitter)
+ {
+ quantify_start_recording_data ();
+ }
+#endif /* quantify */
+
+ ACE_TIMEPROBE ("time to read high-res clock and "
+ "compare an int with 0");
+ consumers_->push (event, ACE_TRY_ENV);
+ }
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCH (CosEventComm::Disconnected, d)
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) Utilization_Supplier::push: disconnected.\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) %s Utilization_Supplier::push:"
+ " unexpected exception.\n",
+ entry_point ()));
+ }
+ ACE_ENDTRY;
+
+ // Check if we're done.
+ if (master_ && (total_sent_ >= total_messages_))
+ this->shutdown ();
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) %s received unexpected events: ",
+ entry_point ()));
+ ::dump_sequence (events);
+ return;
+ }
+}
+
+void
+Utilization_Supplier::shutdown (void)
+{
+ shutting_down = 1;
+
+ #if defined (quantify)
+ // Need to stop recording here even if testing for jitter, because
+ // recording is still probably enabled.
+ quantify_stop_recording_data ();
+ if (! measure_jitter)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) stopped Quantify recording\n"));
+ }
+ #endif /* quantify */
+
+ const ACE_hrtime_t now = ACE_OS::gethrtime ();
+ test_stop_time_.set (now / 1000000000, (now / 1 % 1000000000) / 1000);
+
+ static int total_iterations = 1;
+ if (--total_iterations > 0)
+ {
+ total_sent_ = 0;
+ return;
+ }
+
+ ACE_TRY
+ {
+ if (master_)
+ {
+ // Create the shutdown message.
+ CosEventComm::Event event;
+ event.source_ = this;
+ event.type_ = ACE_ES_EVENT_SHUTDOWN;
+
+ // Push the shutdown event.
+ consumers_->push (event, ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+
+ // Disconnect from the channel.
+ consumers_->disconnect_push_consumer (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ // Disconnect from the push supplier.
+ suppliers_->disconnect_push_supplier (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+
+ if (master_)
+ channel_admin_->destroy (ACE_TRY_ENV);
+ ACE_CHECK_ENV;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, "(%t) %s Utilization_Supplier::shutdown:"
+ " unexpected exception.\n",
+ entry_point ()));
+ }
+ ACE_ENDTRY;
+}
+
+
+void
+Utilization_Supplier::print_stats () /* const */
+{
+ ACE_Time_Value test_elapsed_time (test_stop_time_ - test_start_time_);
+ const u_int elapsed = test_elapsed_time.sec () * 1000000 +
+ test_elapsed_time.usec (); // usec
+
+ ACE_DEBUG ((LM_TRACE,
+ "%s: delivered %u events to %u consumer(s) in %u msec;\n"
+ " per-event average was %8.3f msec.\n",
+ entry_point (),
+ total_sent_,
+ consumers / suppliers + consumers % suppliers,
+ elapsed / 1000,
+ (double) elapsed / total_sent_ / 1000.0));
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// class Scavenger
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+Scavenger::Scavenger (const int priority)
+ : ACE_Task<ACE_NULL_SYNCH> (ACE_Thread_Manager::instance ()),
+ priority_ (priority),
+ iterations_ (0)
+{
+}
+
+Scavenger::~Scavenger ()
+{
+}
+
+int
+Scavenger::open (void *arg)
+{
+ ACE_UNUSED_ARG (arg);
+
+ long flags = THR_BOUND | THR_SCHED_FIFO;
+
+ // Become an active object.
+ if (this->activate (flags, 1, 0, this->priority_) == -1)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ "(%t) task activation at priority %d failed, exiting\n%a",
+ priority_, -1));
+ }
+
+ return 0;
+}
+
+int
+Scavenger::svc (void)
+{
+ // Make sure that its thread has the proper priority.
+ ACE_hthread_t thr_handle;
+ ACE_Thread::self (thr_handle);
+ int prio;
+
+ if (ACE_Thread::getprio (thr_handle, prio) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "getprio failed"), -1);
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) SCAVENGER prio = %d, priority_ = %d\n",
+ prio, this->priority_));
+
+ if (this->priority_ != prio)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "improper priority: %d\n", prio), -1);
+ }
+
+ // Wait here until the Consumer is running.
+ start_scavenger.wait ();
+
+ for (u_long i = 0;
+ ! shutting_down &&
+ i < timeout_interval * 1000 / 40.2 * total_messages * 3;
+ ++i)
+ {
+ u_long n = 1279ul; /* takes about 40.2 usecs */
+ ACE::is_prime (n,
+ 2ul /* min_factor */,
+ n/2 /* max_factor */);
+
+ iterations_ += 1; // ACE_U_LongLong doesn't have ++
+ }
+
+ if (! shutting_down)
+ {
+ ACE_OS::fprintf (stderr, "Scavenger timed out!!!!\n");
+ }
+
+ return 0;
+}
+
+void
+Scavenger::print_status ()
+{
+ ACE_OS::fprintf (stderr, "Scavenger processed %llu iterations\n",
+ iterations_ / 1ul);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// function get_options
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+static
+unsigned int
+get_options (int argc, char *argv [])
+{
+ ACE_Get_Opt get_opt (argc, argv, "c:djm:s:t:?");
+ int opt;
+ int temp;
+
+ while ((opt = get_opt ()) != EOF)
+ {
+ switch (opt) {
+ case 'c':
+ if ((temp = ACE_OS::atoi (get_opt.optarg)) > 0)
+ {
+ consumers = (u_int) temp;
+ }
+ else
+ {
+ cerr << argv [0] << ": number of consumers must be > 0" << endl;
+ return 1;
+ }
+ break;
+ case 'd':
+ short_circuit_EC = 1;
+ break;
+ case 'j':
+ measure_jitter = 1;
+ break;
+ case 'm':
+ if ((temp = ACE_OS::atoi (get_opt.optarg)) > 0)
+ {
+ total_messages = (u_int) temp;
+ }
+ else
+ {
+ cerr << argv [0] << ": count must be > 0" << endl;
+ return 1;
+ }
+ break;
+ case 's':
+ if ((temp = ACE_OS::atoi (get_opt.optarg)) > 0)
+ {
+ suppliers = (u_int) temp;
+ }
+ else
+ {
+ cerr << argv [0] << ": number of suppliers must be > 0" << endl;
+ return 1;
+ }
+ break;
+ case 't':
+ if (ACE_OS::atoi (get_opt.optarg) >= 0)
+ {
+ timeout_interval = ACE_OS::atoi (get_opt.optarg);
+ }
+ else
+ {
+ cerr << argv [0] << ": count must be >= 0" << endl;
+ return 1;
+ }
+ break;
+ case '?':
+ cout << "usage: " << argv [0] << " " << usage << endl;
+ ACE_OS::exit (0);
+ break;
+ default:
+ cerr << argv [0] << ": unknown arg, " << (char) opt << endl;
+ cerr << "usage: " << argv [0] << " " << usage << endl;
+ return 1;
+ }
+ }
+
+ switch (argc - get_opt.optind) {
+ case 0:
+ // OK
+ break;
+ default:
+ cerr << argv [0] << ": too many arguments" << endl;
+ cerr << "usage: " << argv [0] << " " << usage << endl;
+ return 1;
+ }
+
+ return 0;
+}
+
+// ************************************************************
+// This function tells the scheduler to generate a schedule. It will
+// only call it once, so this function can be called multiple times.
+static void
+Generate_Schedule (void)
+{
+ static int once = 0;
+ static ACE_Thread_Mutex m;
+
+ if (once == 0)
+ {
+ ACE_Guard<ACE_Thread_Mutex> ace_mon (m);
+
+ // Double-check.
+ if (once == 0)
+ {
+ once = 1;
+ ACE_Scheduler::status_t result = ACE_Scheduler::instance ().schedule ();
+
+ if (result != ACE_Scheduler::SUCCEEDED)
+ ACE_ERROR ((LM_ERROR, "ACE_Scheduler::schedule failed.\n"));
+ else
+ {
+ if (Scheduler_Runtime::config ())
+ {
+ ACE_DEBUG ((LM_ERROR, "ACE_Scheduler::schedule succeeded.\n"));
+ }
+ }
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// function main
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+int
+main (int argc, char *argv [])
+{
+ int min_priority = ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
+ ACE_SCOPE_THREAD);
+
+ Scavenger scavenger (min_priority);
+
+ if (ACE_OS::sched_params (
+ ACE_Sched_Params (
+ ACE_SCHED_FIFO,
+ ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
+ min_priority,
+ ACE_SCOPE_PROCESS),
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_MAX, "Utilization: user is not superuser, "
+ "so remain in time-sharing class\n"));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_ERROR, "%p\n", "Utilization"));
+ ACE_OS::exit (-1);
+ }
+ }
+
+ u_int i;
+
+ if (get_options (argc, argv)) ACE_OS::exit (-1);
+
+ ACE_Scheduler::instance ().output_level (1);
+
+ // Allocate the timeprobe instance now, so we don't measure
+ // the cost of doing it later.
+ ACE_TIMEPROBE_RESET;
+
+ // Set the scheduler output name.
+ char *orb_argv[3] = { "main", "Scheduler_Utilization_Runtime.cpp", 0 };
+ int orb_argc = 3;
+
+ // Initialize ORB.
+ UPSingleProcessorOrb::ORB_init (orb_argc, orb_argv, "the_ORB");
+
+ // Register Event Service with Naming Service.
+ CosEventChannelAdmin::EventChannel_ptr ec;
+ ACE_NEW_RETURN (ec, ACE_EventChannel, -1);
+
+ EVENT_CHANNEL_NS::RegisterService ("Event Service", NOBJECT, ec);
+
+ // Create supplier(s).
+ Utilization_Supplier **supplier;
+ ACE_NEW_RETURN (supplier, Utilization_Supplier *[suppliers], -1);
+ for (i = 0; i < suppliers; ++i)
+ {
+ ACE_NEW_RETURN (supplier [i],
+ Utilization_Supplier (total_messages, measure_jitter),
+ -1);
+ char supplier_name [BUFSIZ];
+ sprintf (supplier_name, "supplier-%d", i+1);
+ if (supplier [i]->open_supplier (supplier_name, int (i == 0)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "Supplier open failed.\n"), -1);
+ }
+
+ // Create consumers.
+ ACE_NEW_RETURN (consumer, Utilization_Consumer *[consumers], -1);
+ for (i = 0; i < consumers; ++i)
+ {
+ ACE_NEW_RETURN (consumer [i], Utilization_Consumer (measure_jitter), -1);
+ char buf [BUFSIZ];
+ sprintf (buf, "consumer-%d", i+1);
+
+ if ((consumer [i]->open_consumer (buf,
+ supplier [i % suppliers]->entry_point ()) ==
+ -1))
+ ACE_ERROR_RETURN ((LM_ERROR, "Someone was feeling introverted.\n"),
+ -1);
+ }
+
+ #if defined (quantify)
+ if (! measure_jitter)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%t) start Quantify recording\n"));
+ quantify_start_recording_data ();
+ }
+ #endif /* quantify */
+
+ // Tell supplier(s) to generate events.
+ for (i = 0; i < suppliers; ++i)
+ {
+ if (supplier [i]->start_generating_events () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "generate_events failed.\n"), -1);
+ }
+
+
+ scavenger.open ();
+
+ ACE_OS::sleep (1);
+
+ // Enter the main event loop.
+ UPSingleProcessorOrb::Instance ()->impl_is_ready ();
+
+ scavenger.print_status ();
+
+ // Graceful ORB shutdown.
+ UPSingleProcessorOrb::Instance ()->Close ();
+
+ ::Generate_Schedule ();
+
+ for (i = 0; i < suppliers; ++i)
+ {
+ supplier [i]->print_stats ();
+ delete supplier [i];
+ }
+ delete [] supplier;
+
+ for (i = 0; i < consumers; ++i)
+ {
+ consumer [i]->print_stats ();
+ delete consumer [i];
+ }
+ delete [] consumer;
+
+ delete ec;
+
+ ACE_TIMEPROBE_FINI;
+
+ return 0;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+# if ! defined (__ACE_INLINE__)
+ template class UUORB_UtilitiesT<ACE_AbstractEventChannel>;
+ template class UUORB_UtilitiesT<ACE_AbstractPushSupplier>;
+# endif /* ! __ACE_INLINE_ */
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+# if ! defined (__ACE_INLINE__)
+# pragma instantiate UUORB_UtilitiesT<ACE_AbstractEventChannel>
+# pragma instantiate UUORB_UtilitiesT<ACE_AbstractPushSupplier>
+# endif /* ! __ACE_INLINE_ */
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/local/tests/Utilization.h b/TAO/local/tests/Utilization.h
new file mode 100644
index 00000000000..b1394a1c975
--- /dev/null
+++ b/TAO/local/tests/Utilization.h
@@ -0,0 +1,182 @@
+/* -*- C++ -*- */
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// ACE Event Service Benchmarks
+//
+// = FILENAME
+// Utilization.h
+//
+// = AUTHOR
+// David Levine (levine@cs.wustl.edu) and
+// Tim Harrison (harrison@cs.wustl.edu)
+//
+// = DESCRIPTION
+//
+// ============================================================================
+
+#if !defined (UTILIZATION_H)
+#define UTILIZATION_H
+
+#include "RtecEvenCommS.h"
+
+class Utilization_Consumer : public POA_RtecEventComm::PushConsumer
+// = TITLE
+// Utilization Consumer
+//
+// = DESCRIPTION
+// Simple example of a consumer that registers for supplier
+// notifications.
+{
+public:
+ Utilization_Consumer (const int measure_jitter = 0);
+ // Construction. The default of not measuring jitter provides
+ // a "null" push routine, for measuring aggregate timing.
+
+ int open_consumer (const char *my_name, const char *supplier_name);
+ // Uses the name server to obtain a reference to the <supplier_name>
+ // and registers with channel to receive notifications from the
+ // supplier. Also registers to receive shutdown messages from the
+ // supplier. Stores <my_name> for printing out messages. Returns 0
+ // on success, -1 on failure.
+
+ virtual void disconnect_push_consumer (CORBA::Environment &);
+ // The channel is disconnecting.
+
+ const char *entry_point () /* const */ { return rt_info_->entry_point (); }
+
+ void print_stats () /* const */;
+ // Print timing statistics.
+
+// (not protected to allow short-circuiting) protected:
+ virtual void push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &);
+ // If the <events>[0] is a notification, prints out the data from
+ // the supplier. If its a shutdown message, the consumer
+ // disconnects from the channel.
+
+protected:
+ void shutdown (void);
+ // Disconnect from the Event Service.
+
+ // = Event channel adminstration references.
+ RtecEventChannelAdmin::EventChannel_ptr channel_admin_;
+ RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin_;
+ RtecEventChannelAdmin::ProxyPushSupplier_ptr suppliers_;
+
+private:
+ ACE_Scheduler::RT_Info* rt_info_;
+
+ int measure_jitter_;
+
+ ACE_hrtime_t iterations_;
+ ACE_Time_Value min_utilization_;
+ ACE_Time_Value max_utilization_;
+ ACE_Time_Value total_utilization_;
+ u_long total_pushes_;
+ // Registers and counters for keeping track of utilization statistics.
+};
+
+// ************************************************************
+
+class Utilization_Supplier : public POA_RtecEventComm::PushSupplier, public POA_RtecEventComm::PushConsumer
+// = TITLE
+// Utilization Supplier
+//
+// = DESCRIPTION
+// Generates event nofications and a shutdown message.
+{
+public:
+ Utilization_Supplier (const u_int total_messages,
+ const int timestamp = 0);
+ // Construction. Requires the total number of messages to be
+ // sent. If the timestamp flag is enabled, then events are
+ // timestamped, e.g., for use in measuring jitter.
+
+ int open_supplier (const char *name, int master);
+ // Registers with the name server under the given <name>. Also
+ // connects to the Event Channel as a supplier of notifications and
+ // shutdown messages. If <master> != 0, then the supplier will
+ // destroy the channel upon shutting down. Returns 0 on success, -1
+ // on failure.
+
+ virtual void disconnect_push_supplier (CORBA::Environment &);
+ // The channel is disconnecting.
+
+ virtual void disconnect_push_consumer (CORBA::Environment &);
+ // The channel is disconnecting.
+
+ int start_generating_events (void);
+ // Called when the supplier should start generating events.
+ // Registers with the Event Channel to receive timeouts every .25
+ // seconds. Will generate some number of events and then send a
+ // shutdown message. Returns 0 on success, -1 on failure.
+
+ const char *entry_point () /* const */ { return rt_info_->entry_point (); }
+
+ void print_stats () /* const */;
+ // Print timing statistics.
+
+protected:
+ void push (const RtecEventComm::EventSet &events,
+ CORBA::Environment &);
+ // Takes a timestamp and then pushes event_ to all consumers, either
+ // directly, or via a channel.
+
+ void shutdown (void);
+ // Disconnect from the Event Service.
+
+ // = Event Channel adminstration references.
+ RtecEventChannelAdmin::EventChannel_ptr channel_admin_;
+ RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin_;
+ RtecEventChannelAdmin::ProxyPushConsumer_ptr consumers_;
+ RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin_;
+ RtecEventChannelAdmin::ProxyPushSupplier_ptr suppliers_;
+
+private:
+ ACE_Scheduler::RT_Info_ptr rt_info_;
+
+ u_int total_messages_;
+ // How many events to push before ending the test.
+
+ int timestamp_;
+ // Flag indicating whether or not to timestamp outgoing events.
+
+ u_int total_sent_;
+ // How many events we've pushed.
+
+ ACE_Time_Value test_start_time_;
+ ACE_Time_Value test_stop_time_;
+ // Start/stop times, marking the time period when events are
+ // sent to consumers.
+
+ int master_;
+};
+
+
+class Scavenger : public ACE_Task<ACE_NULL_SYNCH>
+// = TITLE
+// Scavenger
+//
+// = DESCRIPTION
+// Soaks up all unused CPU cycles.
+{
+public:
+ Scavenger (const int priority);
+ virtual ~Scavenger ();
+
+ int open (void *);
+ int svc (void);
+ void print_status ();
+
+private:
+ int priority_;
+ ACE_hrtime_t iterations_;
+
+ // not implemented . . .
+ Scavenger ();
+};
+
+#endif /* UTILIZATION_H */