summaryrefslogtreecommitdiff
path: root/examples/Reactor
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-03-13 08:47:33 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-03-13 08:47:33 +0000
commitd3949b7dbe42ce9b768e3b683ae465eb97c5fe76 (patch)
treec7185eb8017a90a963d1007df5b6564a7514d31e /examples/Reactor
parent7e287298eaa42fcdbc7f108dfdfef6ac88cd13ff (diff)
downloadATCD-d3949b7dbe42ce9b768e3b683ae465eb97c5fe76.tar.gz
*** empty log message ***
Diffstat (limited to 'examples/Reactor')
-rw-r--r--examples/Reactor/ReactorEx/Registry_Changes.dsp2
-rw-r--r--examples/Reactor/ReactorEx/reactorex.dsw12
-rw-r--r--examples/Reactor/ReactorEx/test_prerun_state_changes.cpp59
-rw-r--r--examples/Reactor/ReactorEx/test_talker.cpp6
-rw-r--r--examples/Reactor/WFMO_Reactor/Registry_Changes.dsp2
-rw-r--r--examples/Reactor/WFMO_Reactor/reactorex.dsw12
-rw-r--r--examples/Reactor/WFMO_Reactor/test_prerun_state_changes.cpp59
-rw-r--r--examples/Reactor/WFMO_Reactor/test_talker.cpp6
8 files changed, 156 insertions, 2 deletions
diff --git a/examples/Reactor/ReactorEx/Registry_Changes.dsp b/examples/Reactor/ReactorEx/Registry_Changes.dsp
index c5cf0e26615..d49ac6d8b49 100644
--- a/examples/Reactor/ReactorEx/Registry_Changes.dsp
+++ b/examples/Reactor/ReactorEx/Registry_Changes.dsp
@@ -46,7 +46,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# Begin Target
# Name "Registry_Changes - Win32 Debug"
diff --git a/examples/Reactor/ReactorEx/reactorex.dsw b/examples/Reactor/ReactorEx/reactorex.dsw
index 8b441ff87d4..ab36ca6154b 100644
--- a/examples/Reactor/ReactorEx/reactorex.dsw
+++ b/examples/Reactor/ReactorEx/reactorex.dsw
@@ -63,6 +63,18 @@ Package=<4>
###############################################################################
+Project: "Prerun_State_Changes"=.\Prerun_State_Changes.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Registration"=.\Registration.dsp - Package Owner=<4>
Package=<5>
diff --git a/examples/Reactor/ReactorEx/test_prerun_state_changes.cpp b/examples/Reactor/ReactorEx/test_prerun_state_changes.cpp
new file mode 100644
index 00000000000..139d3915072
--- /dev/null
+++ b/examples/Reactor/ReactorEx/test_prerun_state_changes.cpp
@@ -0,0 +1,59 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// examples
+//
+// = FILENAME
+// test_prerun_state_changes.cpp
+//
+// = DESCRIPTION
+//
+// Tests the Reactor's ability to handle state changes before
+// getting a chance to run.
+//
+// = AUTHOR
+//
+// Irfan Pyarali
+//
+// ============================================================================
+
+#include "ace/Reactor.h"
+
+class Event_Handler : public ACE_Event_Handler
+// = TITLE
+// Generic Event Handler.
+//
+{
+public:
+ virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "event handler %d closed.\n",
+ (int) handle));
+ delete this;
+ return 0;
+ }
+};
+
+int
+main (int argc, char *argv[])
+{
+ ACE_HANDLE handle = (ACE_HANDLE) ::socket (PF_INET, SOCK_STREAM, 0);
+
+ Event_Handler *event_handler = new Event_Handler;
+
+ ACE_ASSERT (ACE_Reactor::instance ()->register_handler (handle,
+ event_handler,
+ ACE_Event_Handler::READ_MASK) == 0);
+
+ ACE_ASSERT (ACE_Reactor::instance ()->register_handler (handle,
+ event_handler,
+ ACE_Event_Handler::WRITE_MASK | ACE_Event_Handler::QOS_MASK) == 0);
+
+ ACE_ASSERT (ACE_Reactor::instance ()->remove_handler (handle,
+ ACE_Event_Handler::READ_MASK) == 0);
+
+ return 0;
+}
diff --git a/examples/Reactor/ReactorEx/test_talker.cpp b/examples/Reactor/ReactorEx/test_talker.cpp
index 6e4b62a677d..828747852c9 100644
--- a/examples/Reactor/ReactorEx/test_talker.cpp
+++ b/examples/Reactor/ReactorEx/test_talker.cpp
@@ -542,5 +542,11 @@ main (int argc, char *argv[])
// Run main event demultiplexor.
ACE_Reactor::run_event_loop ();
+ // Remove proactor with Reactor.
+ if (ACE_Reactor::instance ()->remove_handler
+ (ACE_Proactor::instance (), ACE_Event_Handler::DONT_CALL) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p failed to register Proactor.\n",
+ argv[0]), -1);
+
return 0;
}
diff --git a/examples/Reactor/WFMO_Reactor/Registry_Changes.dsp b/examples/Reactor/WFMO_Reactor/Registry_Changes.dsp
index c5cf0e26615..d49ac6d8b49 100644
--- a/examples/Reactor/WFMO_Reactor/Registry_Changes.dsp
+++ b/examples/Reactor/WFMO_Reactor/Registry_Changes.dsp
@@ -46,7 +46,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# Begin Target
# Name "Registry_Changes - Win32 Debug"
diff --git a/examples/Reactor/WFMO_Reactor/reactorex.dsw b/examples/Reactor/WFMO_Reactor/reactorex.dsw
index 8b441ff87d4..ab36ca6154b 100644
--- a/examples/Reactor/WFMO_Reactor/reactorex.dsw
+++ b/examples/Reactor/WFMO_Reactor/reactorex.dsw
@@ -63,6 +63,18 @@ Package=<4>
###############################################################################
+Project: "Prerun_State_Changes"=.\Prerun_State_Changes.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Registration"=.\Registration.dsp - Package Owner=<4>
Package=<5>
diff --git a/examples/Reactor/WFMO_Reactor/test_prerun_state_changes.cpp b/examples/Reactor/WFMO_Reactor/test_prerun_state_changes.cpp
new file mode 100644
index 00000000000..139d3915072
--- /dev/null
+++ b/examples/Reactor/WFMO_Reactor/test_prerun_state_changes.cpp
@@ -0,0 +1,59 @@
+// $Id$
+//
+// ============================================================================
+//
+// = LIBRARY
+// examples
+//
+// = FILENAME
+// test_prerun_state_changes.cpp
+//
+// = DESCRIPTION
+//
+// Tests the Reactor's ability to handle state changes before
+// getting a chance to run.
+//
+// = AUTHOR
+//
+// Irfan Pyarali
+//
+// ============================================================================
+
+#include "ace/Reactor.h"
+
+class Event_Handler : public ACE_Event_Handler
+// = TITLE
+// Generic Event Handler.
+//
+{
+public:
+ virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "event handler %d closed.\n",
+ (int) handle));
+ delete this;
+ return 0;
+ }
+};
+
+int
+main (int argc, char *argv[])
+{
+ ACE_HANDLE handle = (ACE_HANDLE) ::socket (PF_INET, SOCK_STREAM, 0);
+
+ Event_Handler *event_handler = new Event_Handler;
+
+ ACE_ASSERT (ACE_Reactor::instance ()->register_handler (handle,
+ event_handler,
+ ACE_Event_Handler::READ_MASK) == 0);
+
+ ACE_ASSERT (ACE_Reactor::instance ()->register_handler (handle,
+ event_handler,
+ ACE_Event_Handler::WRITE_MASK | ACE_Event_Handler::QOS_MASK) == 0);
+
+ ACE_ASSERT (ACE_Reactor::instance ()->remove_handler (handle,
+ ACE_Event_Handler::READ_MASK) == 0);
+
+ return 0;
+}
diff --git a/examples/Reactor/WFMO_Reactor/test_talker.cpp b/examples/Reactor/WFMO_Reactor/test_talker.cpp
index 6e4b62a677d..828747852c9 100644
--- a/examples/Reactor/WFMO_Reactor/test_talker.cpp
+++ b/examples/Reactor/WFMO_Reactor/test_talker.cpp
@@ -542,5 +542,11 @@ main (int argc, char *argv[])
// Run main event demultiplexor.
ACE_Reactor::run_event_loop ();
+ // Remove proactor with Reactor.
+ if (ACE_Reactor::instance ()->remove_handler
+ (ACE_Proactor::instance (), ACE_Event_Handler::DONT_CALL) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p failed to register Proactor.\n",
+ argv[0]), -1);
+
return 0;
}