summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-08 01:16:17 +0000
committerpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-11-08 01:16:17 +0000
commite60d9a1cbe97a32e01879e3a9ec5414a90ff6714 (patch)
treeb14a79f0cbdc4b01c90f7b5f618ec0a5d8e03e09
parentea134c08e75e6c4185a398beef485c58eaaad32e (diff)
downloadATCD-e60d9a1cbe97a32e01879e3a9ec5414a90ff6714.tar.gz
*** empty log message ***
-rw-r--r--TAO/examples/Event_Comm/Consumer_Handler.cpp5
-rw-r--r--TAO/examples/Event_Comm/Consumer_Input_Handler.cpp7
-rw-r--r--TAO/examples/Event_Comm/Event_Comm.idl3
-rw-r--r--TAO/examples/Event_Comm/Event_Comm_i.cpp33
-rw-r--r--TAO/examples/Event_Comm/Event_Comm_i.h3
-rw-r--r--TAO/examples/Event_Comm/README6
-rw-r--r--TAO/examples/Event_Comm/Supplier_Input_Handler.cpp18
-rw-r--r--TAO/examples/Event_Comm/consumer.cpp5
8 files changed, 41 insertions, 39 deletions
diff --git a/TAO/examples/Event_Comm/Consumer_Handler.cpp b/TAO/examples/Event_Comm/Consumer_Handler.cpp
index 14b728535dc..c2b86f0eb20 100644
--- a/TAO/examples/Event_Comm/Consumer_Handler.cpp
+++ b/TAO/examples/Event_Comm/Consumer_Handler.cpp
@@ -42,8 +42,9 @@ Consumer_Handler::init (int argc,
TAO_CHECK_ENV;
// Save the Shutdown callback.
- this->consumershutdown = _consumershutdown;
- // Set the ConsumerShutdown callback object.
+ this->consumershutdown = _consumershutdown;
+ // Set the ConsumerShutdown callback object
+ // in the Consumer object implementation.
this->receiver_i_.set (_consumershutdown);
// Start the servant.
diff --git a/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp b/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp
index 099a3c289ab..9d3aac119d5 100644
--- a/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp
+++ b/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp
@@ -6,8 +6,7 @@
ACE_RCSID(Consumer, Consumer_Input_Handler, "$Id$")
Consumer_Input_Handler::Consumer_Input_Handler (void)
- : //handle_ (0),
- receiver_handler_ (0),
+ : receiver_handler_ (0),
consumer_initiated_shutdown_ (0)
{
// No-Op.
@@ -111,9 +110,7 @@ Consumer_Input_Handler::handle_input (ACE_HANDLE h)
}
else
{
- ACE_OS::strcpy (buf, "quit");
- ACE_DEBUG ((LM_DEBUG,
- "shutting down Input_Handler\n"));
+ // If nothing is read, do nothing.
return 0;
}
diff --git a/TAO/examples/Event_Comm/Event_Comm.idl b/TAO/examples/Event_Comm/Event_Comm.idl
index ee226af0497..5c04344ea9a 100644
--- a/TAO/examples/Event_Comm/Event_Comm.idl
+++ b/TAO/examples/Event_Comm/Event_Comm.idl
@@ -13,7 +13,8 @@
// The CORBA IDL module for distributed event notification.
//
// = AUTHOR
-// Douglas C. Schmidt (schmidt@cs.wustl.edu)
+// Douglas C. Schmidt (schmidt@cs.wustl.edu) and
+// Pradeep Gore (pradeep@cs.wustl.edu)
//
// ============================================================================
diff --git a/TAO/examples/Event_Comm/Event_Comm_i.cpp b/TAO/examples/Event_Comm/Event_Comm_i.cpp
index 03992d8b20e..5c2cc8e288f 100644
--- a/TAO/examples/Event_Comm/Event_Comm_i.cpp
+++ b/TAO/examples/Event_Comm/Event_Comm_i.cpp
@@ -102,15 +102,15 @@ Consumer_Entry::Consumer_Entry (Event_Comm::Consumer *consumer,
ACE_OS::strdup (""));
else
{
- #if defined (ACE_HAS_REGEX)
+#if defined (ACE_HAS_REGEX)
// Compile the regular expression (the 0's cause ACE_OS::compile
// to allocate space).
compile_buffer = ACE_OS::compile (filtering_criteria, 0, 0);
- #else
- // Win32 does not support regular expression functions such as compile.
- ACE_ALLOCATOR (compile_buffer,
+#else
+ // Win32 does not support regular expression functions such as compile.
+ ACE_ALLOCATOR (compile_buffer,
ACE_OS::strdup (""));
- #endif // #if defined (ACE_HAS_REGEX)
+#endif // #if defined (ACE_HAS_REGEX)
}
// Should throw an exception here!
@@ -138,11 +138,12 @@ Notifier_i::Notifier_i (size_t size)
// if platforms (such as win32) do not support the REGEXP functions
// such as <compile> and <step> then warn the user that the regular
// expression feature is not available.
- #ifndef ACE_HAS_REGEX
- ACE_DEBUG ((LM_DEBUG, "\n WARNING: This platform does not support the functions\
- for regular expressions.\n\
- The filtering criteria will not work.\n"));
- #endif //#ifndef ACE_HAS_REGEX
+#ifndef ACE_HAS_REGEX
+ ACE_DEBUG ((LM_DEBUG, "\n WARNING: This platform does not support\
+the functions\
+for regular expressions.\n\
+The filtering criteria will not work.\n"));
+#endif //#ifndef ACE_HAS_REGEX
}
// Add a new consumer to the table, being careful to check for
@@ -289,7 +290,7 @@ Notifier_i::disconnect (const char *reason,
mi.advance ())
{
Event_Comm::Consumer_ptr consumer_ref =
- me->ext_id_; //int_id_->consumer ();
+ me->ext_id_;
ACE_ASSERT (consumer_ref != 0);
ACE_DEBUG ((LM_DEBUG,
@@ -344,13 +345,13 @@ Notifier_i::push (const Event_Comm::Event &event,
const char *criteria = me->int_id_->criteria ();
ACE_ASSERT (criteria);
- #if defined (ACE_HAS_REGEX)
- // Do a regular expression comparison to determine matching.
+#if defined (ACE_HAS_REGEX)
+ // Do a regular expression comparison to determine matching.
if (ACE_OS::strcmp ("", criteria) == 0 // Everything matches the wildcard.
|| ACE_OS::step (event.tag_, regexp) != 0)
- #endif // #if defined (ACE_HAS_REGEX)
- // if ACE_HAS_REGEX has not been defined,
- // let everything through.
+#endif // #if defined (ACE_HAS_REGEX)
+ // if ACE_HAS_REGEX has not been defined,
+ // let everything through.
{
ACE_DEBUG ((LM_DEBUG,
"string %s matched regexp \"%s\" for client %x\n",
diff --git a/TAO/examples/Event_Comm/Event_Comm_i.h b/TAO/examples/Event_Comm/Event_Comm_i.h
index 94d18e12816..7eb3212ccf8 100644
--- a/TAO/examples/Event_Comm/Event_Comm_i.h
+++ b/TAO/examples/Event_Comm/Event_Comm_i.h
@@ -68,7 +68,8 @@ public:
// Set the Shutdown callback.
private:
-ConsumerShutdown *consumershutdown;
+ ConsumerShutdown *consumershutdown;
+ // The callback to shutdown the consumer application.
};
// Forward reference.
diff --git a/TAO/examples/Event_Comm/README b/TAO/examples/Event_Comm/README
index b0cc528e762..69075bef213 100644
--- a/TAO/examples/Event_Comm/README
+++ b/TAO/examples/Event_Comm/README
@@ -35,7 +35,7 @@ Supplier:
To run the supplier type:
supplier
- To exit the supplier type CTRL-C.
+ To exit the supplier type CTRL-C or type "quit".
To send strings to the Consumers, type the string on the prompt
and press ENTER.
@@ -88,10 +88,10 @@ To run the tests do the following:
from a Consumer to all other Consumers by typing messages in a
Consumer window.
- Note that if you type "quit", ^C in a Consumer window the
+ Note that if you type "quit" or ^C in a Consumer window the
Consumer will unsubscribe and shutdown its handlers and exit.
Likewise, if you type ^C in the Notifier window
the Notifier will disconnect all of its Consumers and exit.
6. When you want to terminate a Consumer or a Supplier, just type ^C
- and the process will shut down gracefully.
+ or "quit" and the process will shut down gracefully.
diff --git a/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp b/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp
index f6513ebc7ef..27d3c4b9a72 100644
--- a/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp
+++ b/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp
@@ -7,8 +7,7 @@
ACE_RCSID(Supplier, Supplier_Input_Handler, "$Id$")
Supplier_Input_Handler::Supplier_Input_Handler ()
- : //handle_ (0),
- notifier_ (0)
+ : notifier_ (0)
{
// No-Op.
}
@@ -28,11 +27,12 @@ Supplier_Input_Handler::close (void)
// Make sure to cleanup the STDIN handler.
if (ACE_Event_Handler::remove_stdin_handler
- (TAO_ORB_Core_instance ()->reactor (),
+ (
+ ACE_Reactor::instance (),
TAO_ORB_Core_instance ()->thr_mgr ()) == -1)
- ACE_ERROR ((LM_ERROR,
- "%p\n",
- "remove_stdin_handler"));
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "remove_stdin_handler"));
return 0;
}
@@ -45,7 +45,7 @@ Supplier_Input_Handler::initialize (Notifier_Handler *notifier)
if (ACE_Event_Handler::register_stdin_handler
(this,
- TAO_ORB_Core_instance ()->reactor (),
+ ACE_Reactor::instance (),
TAO_ORB_Core_instance ()->thr_mgr ()) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"%p\n",
@@ -67,7 +67,7 @@ Supplier_Input_Handler::handle_input (ACE_HANDLE h)
if (ACE_OS::fgets (buf,
sizeof buf - 1,
- stdin) == 0)
+ stdin) == 0)
{
ACE_OS::strcpy (buf,
"quit");
@@ -91,7 +91,7 @@ Supplier_Input_Handler::handle_input (ACE_HANDLE h)
Event_Comm::Notifier *notifier = this->notifier_->notifier ();
ACE_ASSERT (notifier != 0);
- if (ACE_OS::strcmp (buf, "quit") == 0)
+ if (ACE_OS::strncmp (buf, "quit", 4) == 0)
// Tell the main event loop to shutdown.
ACE_Reactor::end_event_loop ();
else
diff --git a/TAO/examples/Event_Comm/consumer.cpp b/TAO/examples/Event_Comm/consumer.cpp
index f68bec38361..fcbb5392952 100644
--- a/TAO/examples/Event_Comm/consumer.cpp
+++ b/TAO/examples/Event_Comm/consumer.cpp
@@ -28,7 +28,7 @@ public:
// Execute the consumer;
virtual void close (void);
- // shutdown the consumer.
+ // Shutdown the consumer.
private:
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
@@ -71,8 +71,9 @@ Consumer::handle_signal (int signum,
void
Consumer::close (void)
{
- // Shut down the ORB
+ // clean up the input handler.
ih_.close ();
+ // Shut down the ORB
ch_.close ();
}