diff options
Diffstat (limited to 'examples/Reactor')
100 files changed, 0 insertions, 13643 deletions
diff --git a/examples/Reactor/Dgram/CODgram.cpp b/examples/Reactor/Dgram/CODgram.cpp deleted file mode 100644 index 5505bcb7ab0..00000000000 --- a/examples/Reactor/Dgram/CODgram.cpp +++ /dev/null @@ -1,250 +0,0 @@ -// $Id$ - -// Exercise the <ACE_SOCK_CODgram> wrapper along with the -// <ACE_Reactor>. This test simply ping-pongs datagrams back and -// forth between the peer1 and peer2 processes. This test can -// be run in two ways: -// -// 1. Stand-alone -- e.g., -// -// % ./CODgram -// -// which will spawn a child process and run peer1 and peer2 -// in different processes on the same machine. -// -// 2. Distributed -- e.g., -// -// # Peer1 -// % ./CODgram 10002 tango.cs.wustl.edu 10003 peer1 -// -// # Peer1 -// % ./CODgram 10003 tango.cs.wustl.edu 10002 peer2 -// -// which will run peer1 and peer2 in different processes -// on the same or different machines. Note that you MUST -// give the name "peer1" as the final argument to one and -// only one of the programs so that the test will work properly. - -#include "ace/Reactor.h" -#include "ace/SOCK_CODgram.h" -#include "ace/INET_Addr.h" -#include "ace/Process.h" - -ACE_RCSID(Dgram, CODgram, "$Id$") - -// Port used to receive for dgrams. -static u_short port1; - -class Dgram_Endpoint : public ACE_Event_Handler -{ -public: - Dgram_Endpoint (const ACE_INET_Addr &remote_addr, - const ACE_INET_Addr &local_addr); - - // = Hook methods inherited from the <ACE_Event_Handler>. - virtual ACE_HANDLE get_handle (void) const; - virtual int handle_input (ACE_HANDLE handle); - virtual int handle_timeout (const ACE_Time_Value & tv, - const void *arg = 0); - - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - - int send (const char *buf, size_t len); - // Send the <buf> to the peer. - -private: - ACE_SOCK_CODgram endpoint_; - // Wrapper for sending/receiving dgrams. -}; - -int -Dgram_Endpoint::send (const char *buf, size_t len) -{ - return this->endpoint_.send (buf, len); -} - -int -Dgram_Endpoint::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask) -{ - ACE_UNUSED_ARG (handle); - - this->endpoint_.close (); - return 0; -} - -Dgram_Endpoint::Dgram_Endpoint (const ACE_INET_Addr &remote_addr, - const ACE_INET_Addr &local_addr) - : endpoint_ (remote_addr, local_addr) -{ -} - -ACE_HANDLE -Dgram_Endpoint::get_handle (void) const -{ - return this->endpoint_.get_handle (); -} - -int -Dgram_Endpoint::handle_input (ACE_HANDLE) -{ - char buf[BUFSIZ]; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) activity occurred on handle %d!\n", - this->endpoint_.get_handle ())); - - ssize_t n = this->endpoint_.recv (buf, sizeof buf); - - if (n == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "handle_input")); - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) buf of size %d = %*s\n", - n, n, buf)); - return 0; -} - -int -Dgram_Endpoint::handle_timeout (const ACE_Time_Value &, - const void *) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) timed out for endpoint\n")); - return 0; -} - -static int -run_test (u_short localport, - const char *remotehost, - u_short remoteport, - const char *peer) -{ - ACE_INET_Addr remote_addr (remoteport, - remotehost); - ACE_INET_Addr local_addr (localport); - - Dgram_Endpoint endpoint (remote_addr, local_addr); - - // Read data from other side. - if (ACE_Reactor::instance ()->register_handler - (&endpoint, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "ACE_Reactor::register_handler"), - -1); - char buf[BUFSIZ]; - ACE_OS::strcpy (buf, - "Data to transmit"); - size_t len = ACE_OS::strlen (buf); - - // "peer1" is the "initiator." - if (ACE_OS::strncmp (peer, "peer1", 5) == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) sending data\n")); - for (size_t i = 0; i < 20; i++) - { - endpoint.send (buf, len); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) .\n")); - ACE_OS::sleep (1); - } - } - - for (int i = 0; i < 40; i++) - { - // Wait up to 10 seconds for data. - ACE_Time_Value tv (10, 0); - - if (ACE_Reactor::instance ()->handle_events (tv) <= 0) - ACE_ERROR_RETURN ((LM_DEBUG, - "(%P|%t) %p\n", - "handle_events"), - -1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) return from handle events\n")); - - endpoint.send (buf, len); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) .\n")); - } - - if (ACE_Reactor::instance ()->remove_handler - (&endpoint, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "ACE_Reactor::remove_handler"), - -1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) exiting\n")); - return 0; -} - -int -main (int argc, char *argv[]) -{ - // Estabish call backs and socket names. - - port1 = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT; - const char *remotehost = argc > 2 ? argv[2] : ACE_DEFAULT_SERVER_HOST; - const u_short port2 = argc > 3 ? ACE_OS::atoi (argv[3]) : port1 + 1; - - // Providing the fourth command line argument indicates we don't - // want to spawn a new process. On Win32, we use this to exec the - // new program. - if (argc > 4) - run_test (port1, - remotehost, - port2, - argv[4]); - else - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) local port = %d, remote host = %s, remote port = %d\n", - port1, - remotehost, - port2)); - - ACE_Process_Options options; - options.command_line ("%s %d %s %d %c", - argv[0], - port1, - remotehost, - port2, - 'c'); - - // This has no effect on NT and will spawn a process that exec - // the above run_test function. - options.creation_flags (ACE_Process_Options::NO_EXEC); - - ACE_Process new_process; - - switch (new_process.spawn (options)) - { - case -1: - return -1; - - case 0: - run_test (port1, - remotehost, - port2, - "peer1"); - break; - - default: - run_test (port2, - remotehost, - port1, - "peer2"); - new_process.wait (); - break; - } - } - - return 0; -} diff --git a/examples/Reactor/Dgram/CODgram.dsp b/examples/Reactor/Dgram/CODgram.dsp deleted file mode 100644 index 48c03263393..00000000000 --- a/examples/Reactor/Dgram/CODgram.dsp +++ /dev/null @@ -1,89 +0,0 @@ -# Microsoft Developer Studio Project File - Name="CODgram" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=CODgram - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "CODgram.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "CODgram.mak" CFG="CODgram - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "CODgram - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "CODgram - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "CODgram - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /machine:I386
-# ADD LINK32 ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace"
-
-!ELSEIF "$(CFG)" == "CODgram - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "CODgram - Win32 Release"
-# Name "CODgram - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\CODgram.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Dgram/Dgram.cpp b/examples/Reactor/Dgram/Dgram.cpp deleted file mode 100644 index 2263b98880f..00000000000 --- a/examples/Reactor/Dgram/Dgram.cpp +++ /dev/null @@ -1,254 +0,0 @@ -// $Id$ - -// Exercise the <ACE_SOCK_Dgram> wrapper along with the <ACE_Reactor>. -// This test simply ping-pongs datagrams back and forth between the -// peer1 and peer2 processes. This test can be run in two ways: -// -// 1. Stand-alone -- e.g., -// -// % ./Dgram -// -// which will spawn a child process and run peer1 and peer2 -// in different processes on the same machine. -// -// 2. Distributed -- e.g., -// -// # Peer1 -// % ./Dgram 10002 tango.cs.wustl.edu 10003 peer1 -// -// # Peer1 -// % ./Dgram 10003 tango.cs.wustl.edu 10002 peer2 -// -// which will run peer1 and peer2 in different processes -// on the same or different machines. Note that you MUST -// give the name "peer1" as the final argument to one and -// only one of the programs so that the test will work properly. - -#include "ace/Reactor.h" -#include "ace/Process.h" -#include "ace/SOCK_Dgram.h" -#include "ace/INET_Addr.h" - -ACE_RCSID(Dgram, Dgram, "$Id$") - -// Port used to receive for dgrams. -static u_short port1; - -class Dgram_Endpoint : public ACE_Event_Handler -{ -public: - Dgram_Endpoint (const ACE_INET_Addr &local_addr); - - // = Hook methods inherited from the <ACE_Event_Handler>. - virtual ACE_HANDLE get_handle (void) const; - virtual int handle_input (ACE_HANDLE handle); - virtual int handle_timeout (const ACE_Time_Value & tv, - const void *arg = 0); - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - - int send (const char *buf, size_t len, const ACE_INET_Addr &); - // Send the <buf> to the peer. - -private: - ACE_SOCK_Dgram endpoint_; - // Wrapper for sending/receiving dgrams. -}; - -int -Dgram_Endpoint::send (const char *buf, - size_t len, - const ACE_INET_Addr &addr) -{ - return this->endpoint_.send (buf, len, addr); -} - -Dgram_Endpoint::Dgram_Endpoint (const ACE_INET_Addr &local_addr) - : endpoint_ (local_addr) -{ -} - -ACE_HANDLE -Dgram_Endpoint::get_handle (void) const -{ - return this->endpoint_.get_handle (); -} - -int -Dgram_Endpoint::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask) -{ - ACE_UNUSED_ARG (handle); - - this->endpoint_.close (); - delete this; - return 0; -} - -int -Dgram_Endpoint::handle_input (ACE_HANDLE) -{ - char buf[BUFSIZ]; - ACE_INET_Addr from_addr; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) activity occurred on handle %d!\n", - this->endpoint_.get_handle ())); - - ssize_t n = this->endpoint_.recv (buf, - sizeof buf, - from_addr); - - if (n == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "handle_input")); - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) buf of size %d = %*s\n", - n, - n, - buf)); - return 0; -} - -int -Dgram_Endpoint::handle_timeout (const ACE_Time_Value &, - const void *) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) timed out for endpoint\n")); - return 0; -} - -static int -run_test (u_short localport, - const char *remotehost, - u_short remoteport, - const char *peer) -{ - ACE_INET_Addr remote_addr (remoteport, - remotehost); - ACE_INET_Addr local_addr (localport); - - Dgram_Endpoint *endpoint; - - ACE_NEW_RETURN (endpoint, - Dgram_Endpoint (local_addr), - -1); - - // Read data from other side. - if (ACE_Reactor::instance ()->register_handler - (endpoint, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "ACE_Reactor::register_handler"), - -1); - - char buf[BUFSIZ]; - ACE_OS::strcpy (buf, "Data to transmit"); - size_t len = ACE_OS::strlen (buf); - - if (ACE_OS::strncmp (peer, "peer1", 5) == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) sending data\n")); - - for (size_t i = 0; i < 20; i++) - { - endpoint->send (buf, len, remote_addr); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) .\n")); - ACE_OS::sleep (1); - } - } - - for (int i = 0; i < 40; i++) - { - // Wait up to 10 seconds for data. - ACE_Time_Value tv (10, 0); - - if (ACE_Reactor::instance ()->handle_events (tv) <= 0) - ACE_ERROR_RETURN ((LM_DEBUG, - "(%P|%t) %p\n", - "handle_events"), - -1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) return from handle events\n")); - - endpoint->send (buf, len, remote_addr); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) .\n")); - } - - if (ACE_Reactor::instance ()->remove_handler - (endpoint, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "ACE_Reactor::remove_handler"), - -1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) exiting\n")); - return 0; -} - -int -main (int argc, char *argv[]) -{ - // Estabish call backs and socket names. - - port1 = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT; - const char *remotehost = argc > 2 ? argv[2] : ACE_DEFAULT_SERVER_HOST; - const u_short port2 = argc > 3 ? ACE_OS::atoi (argv[3]) : port1 + 1; - - // Providing the fourth command line argument indicate we don't want - // to spawn a new process. On Win32, we use this to exec the new - // program. - if (argc > 4) - run_test (port1, remotehost, port2, argv[4]); - else - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) local port = %d, remote host = %s, remote port = %d\n", - port1, - remotehost, - port2)); - - ACE_Process_Options options; - options.command_line ("%s %d %s %d %c", - argv[0], - port1, - remotehost, - port2, - 'c'); - - // This has no effect on NT and will spawn a process that exec - // the above run_test function. - options.creation_flags (ACE_Process_Options::NO_EXEC); - - ACE_Process new_process; - switch (new_process.spawn (options)) - { - case -1: - return -1; - - case 0: - run_test (port1, - remotehost, - port2, - "peer1"); - break; - - default: - run_test (port2, - remotehost, - port1, - "peer2"); - new_process.wait (); - break; - } - } - return 0; -} diff --git a/examples/Reactor/Dgram/Dgram.dsp b/examples/Reactor/Dgram/Dgram.dsp deleted file mode 100644 index b7a923e540f..00000000000 --- a/examples/Reactor/Dgram/Dgram.dsp +++ /dev/null @@ -1,89 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Dgram" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Dgram - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Dgram.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Dgram.mak" CFG="Dgram - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Dgram - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Dgram - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Dgram - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /machine:I386
-# ADD LINK32 ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace"
-
-!ELSEIF "$(CFG)" == "Dgram - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "Dgram - Win32 Release"
-# Name "Dgram - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\Dgram.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Dgram/Dgram.dsw b/examples/Reactor/Dgram/Dgram.dsw deleted file mode 100644 index 92cf3688b71..00000000000 --- a/examples/Reactor/Dgram/Dgram.dsw +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "CODgram"=.\CODgram.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Dgram"=.\Dgram.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/Reactor/Dgram/Makefile b/examples/Reactor/Dgram/Makefile deleted file mode 100644 index 095ecab8cf4..00000000000 --- a/examples/Reactor/Dgram/Makefile +++ /dev/null @@ -1,192 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile for a test of the CODgram and Dgram facilities and the Reactor -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = CODgram Dgram - -LSRC = CODgram.cpp Dgram.cpp - -LDLIBS = - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VBIN) - -INSTALL = - -#---------------------------------------------------------------------------- -# 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 - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -.obj/CODgram.o .obj/CODgram.so .shobj/CODgram.o .shobj/CODgram.so: CODgram.cpp \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.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/QoS_Session.h \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_IO.i \ - $(ACE_ROOT)/ace/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Process.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Process.i - -.obj/Dgram.o .obj/Dgram.so .shobj/Dgram.o .shobj/Dgram.so: Dgram.cpp $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Process.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Process.i \ - $(ACE_ROOT)/ace/SOCK_Dgram.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/QoS_Session.h \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_Dgram.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Reactor/FIFO/Makefile b/examples/Reactor/FIFO/Makefile deleted file mode 100644 index 7a37c612d88..00000000000 --- a/examples/Reactor/FIFO/Makefile +++ /dev/null @@ -1,141 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile for testing the Reactor and FIFOs -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = client \ - server - -LSRC = $(addsuffix .cpp,$(BIN)) - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# 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 - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -.obj/client.o .obj/client.so .shobj/client.o .shobj/client.so: client.cpp \ - $(ACE_ROOT)/ace/FIFO_Send_Msg.h \ - $(ACE_ROOT)/ace/FIFO_Send.h \ - $(ACE_ROOT)/ace/FIFO.h \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/FIFO.i \ - $(ACE_ROOT)/ace/FIFO_Send.i \ - $(ACE_ROOT)/ace/FIFO_Send_Msg.i - -.obj/server.o .obj/server.so .shobj/server.o .shobj/server.so: server.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/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.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/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/FIFO_Recv_Msg.h \ - $(ACE_ROOT)/ace/FIFO_Recv.h \ - $(ACE_ROOT)/ace/FIFO.h \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/FIFO.i \ - $(ACE_ROOT)/ace/FIFO_Recv.i \ - $(ACE_ROOT)/ace/FIFO_Recv_Msg.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Reactor/FIFO/client.cpp b/examples/Reactor/FIFO/client.cpp deleted file mode 100644 index f9a4e00e789..00000000000 --- a/examples/Reactor/FIFO/client.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// $Id$ - -#include "ace/FIFO_Send_Msg.h" - -ACE_RCSID(FIFO, client, "$Id$") - -int -main (int, char *[]) -{ - char buf[] = "hello world"; - ACE_Str_Buf msg (buf, sizeof buf); - - ACE_FIFO_Send_Msg fifo_sender (ACE_DEFAULT_RENDEZVOUS, - O_WRONLY | O_CREAT, - ACE_DEFAULT_FILE_PERMS); - - if (fifo_sender.send (msg) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send error for fifo"), -1); - else - return 0; -} diff --git a/examples/Reactor/FIFO/server.cpp b/examples/Reactor/FIFO/server.cpp deleted file mode 100644 index f90db6ab9f8..00000000000 --- a/examples/Reactor/FIFO/server.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// $Id$ - -#include "ace/Service_Config.h" -#include "ace/FIFO_Recv_Msg.h" - -ACE_RCSID(FIFO, server, "$Id$") - -class FIFO_Recv_Handler : public ACE_Event_Handler -{ -public: - FIFO_Recv_Handler (void); - ~FIFO_Recv_Handler (void); - - virtual ACE_HANDLE get_handle (void) const; - virtual int handle_input (ACE_HANDLE fd); - -private: - ACE_FIFO_Recv_Msg fifo_reader_; -}; - -FIFO_Recv_Handler::FIFO_Recv_Handler (void) -{ - ACE_OS::unlink (ACE_DEFAULT_RENDEZVOUS); - - // Make sure to open the FIFO with the "persistent" flag enabled - // (which is the default). - if (this->fifo_reader_.open (ACE_DEFAULT_RENDEZVOUS) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "open")); - - // Register with the Reactor. - if (ACE_Reactor::instance ()->register_handler - (this, ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "register_handler")); -} - -ACE_HANDLE -FIFO_Recv_Handler::get_handle (void) const -{ - return this->fifo_reader_.get_handle (); -} - -FIFO_Recv_Handler::~FIFO_Recv_Handler (void) -{ - this->fifo_reader_.close (); - this->fifo_reader_.remove (); -} - -int -FIFO_Recv_Handler::handle_input (ACE_HANDLE) -{ - char buf[BUFSIZ]; - - ACE_DEBUG ((LM_DEBUG, "handle_input\n")); - - ACE_Str_Buf msg (buf, 0, sizeof buf); - - ssize_t n = this->fifo_reader_.recv (msg); - - if (n < 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "recv"), -1); - else - { - ACE_DEBUG ((LM_DEBUG, "msg.len = %d, n = %d\n", msg.len, n)); - - if (msg.len > 0) - { - // Do some work in here... - ACE_DEBUG ((LM_DEBUG, "msg.buf = %s\n", msg.buf)); - } - return 0; - } -} - -int -main (int, char *argv[]) -{ - ACE_Service_Config daemon (argv[0]); - - FIFO_Recv_Handler fr_handler; - - ACE_Reactor::run_event_loop (); - - return 0; -} diff --git a/examples/Reactor/Makefile b/examples/Reactor/Makefile deleted file mode 100644 index 05645fdf3ef..00000000000 --- a/examples/Reactor/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id: Makefile 1.1 10/18/96 -# -# Makefile for the Reactor tests -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -DIRS = Dgram \ - FIFO \ - Misc \ - Multicast \ - Ntalker - -#---------------------------------------------------------------------------- -# 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/examples/Reactor/Misc/Makefile b/examples/Reactor/Misc/Makefile deleted file mode 100644 index ee2bc593139..00000000000 --- a/examples/Reactor/Misc/Makefile +++ /dev/null @@ -1,734 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile for the miscellaneous Reactor examples -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = pingpong \ - notification \ - test_demuxing \ - test_event_handler_t \ - test_reactors \ - test_signals_1 \ - test_signals_2 \ - test_time_value \ - test_early_timeouts \ - test_timer_queue - -LSRC = $(addsuffix .cpp,$(BIN)) - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# 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 - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -.obj/pingpong.o .obj/pingpong.so .shobj/pingpong.o .shobj/pingpong.so: pingpong.cpp \ - $(ACE_ROOT)/ace/Synch.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/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 \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(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/Free_List.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Pipe.h \ - $(ACE_ROOT)/ace/Pipe.i - -.obj/notification.o .obj/notification.so .shobj/notification.o .shobj/notification.so: notification.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/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.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/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(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/Managed_Object.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.i - -.obj/test_demuxing.o .obj/test_demuxing.so .shobj/test_demuxing.o .shobj/test_demuxing.so: test_demuxing.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/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.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/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/Task.h \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(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/Managed_Object.cpp \ - $(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/Message_Block.i \ - $(ACE_ROOT)/ace/Message_Block_T.h \ - $(ACE_ROOT)/ace/Message_Block_T.i \ - $(ACE_ROOT)/ace/Message_Block_T.cpp \ - $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ - $(ACE_ROOT)/ace/Message_Queue_T.h \ - $(ACE_ROOT)/ace/Message_Queue_T.i \ - $(ACE_ROOT)/ace/Message_Queue_T.cpp \ - $(ACE_ROOT)/ace/Strategies.h \ - $(ACE_ROOT)/ace/Strategies_T.h \ - $(ACE_ROOT)/ace/Synch_Options.h \ - $(ACE_ROOT)/ace/Synch_Options.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager.h \ - $(ACE_ROOT)/ace/Functor.h \ - $(ACE_ROOT)/ace/Functor.i \ - $(ACE_ROOT)/ace/Functor_T.h \ - $(ACE_ROOT)/ace/Functor_T.i \ - $(ACE_ROOT)/ace/Functor_T.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Strategies_T.i \ - $(ACE_ROOT)/ace/Strategies_T.cpp \ - $(ACE_ROOT)/ace/Service_Repository.h \ - $(ACE_ROOT)/ace/Service_Types.h \ - $(ACE_ROOT)/ace/Service_Types.i \ - $(ACE_ROOT)/ace/Service_Repository.i \ - $(ACE_ROOT)/ace/WFMO_Reactor.h \ - $(ACE_ROOT)/ace/WFMO_Reactor.i \ - $(ACE_ROOT)/ace/Strategies.i \ - $(ACE_ROOT)/ace/Message_Queue.i \ - $(ACE_ROOT)/ace/Task_T.i \ - $(ACE_ROOT)/ace/Task_T.cpp \ - $(ACE_ROOT)/ace/Module.h \ - $(ACE_ROOT)/ace/Module.i \ - $(ACE_ROOT)/ace/Module.cpp \ - $(ACE_ROOT)/ace/Stream_Modules.h \ - $(ACE_ROOT)/ace/Stream_Modules.i \ - $(ACE_ROOT)/ace/Stream_Modules.cpp - -.obj/test_event_handler_t.o .obj/test_event_handler_t.so .shobj/test_event_handler_t.o .shobj/test_event_handler_t.so: test_event_handler_t.cpp \ - $(ACE_ROOT)/ace/Event_Handler_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Event_Handler_T.i \ - $(ACE_ROOT)/ace/Event_Handler_T.cpp - -.obj/test_reactors.o .obj/test_reactors.so .shobj/test_reactors.o .shobj/test_reactors.so: test_reactors.cpp \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.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/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Service_Config.i \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/Task.h \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(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/Managed_Object.cpp \ - $(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/Message_Block.i \ - $(ACE_ROOT)/ace/Message_Block_T.h \ - $(ACE_ROOT)/ace/Message_Block_T.i \ - $(ACE_ROOT)/ace/Message_Block_T.cpp \ - $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ - $(ACE_ROOT)/ace/Message_Queue_T.h \ - $(ACE_ROOT)/ace/Message_Queue_T.i \ - $(ACE_ROOT)/ace/Message_Queue_T.cpp \ - $(ACE_ROOT)/ace/Strategies.h \ - $(ACE_ROOT)/ace/Strategies_T.h \ - $(ACE_ROOT)/ace/Synch_Options.h \ - $(ACE_ROOT)/ace/Synch_Options.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager.h \ - $(ACE_ROOT)/ace/Functor.h \ - $(ACE_ROOT)/ace/Functor.i \ - $(ACE_ROOT)/ace/Functor_T.h \ - $(ACE_ROOT)/ace/Functor_T.i \ - $(ACE_ROOT)/ace/Functor_T.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Strategies_T.i \ - $(ACE_ROOT)/ace/Strategies_T.cpp \ - $(ACE_ROOT)/ace/Service_Repository.h \ - $(ACE_ROOT)/ace/Service_Types.h \ - $(ACE_ROOT)/ace/Service_Types.i \ - $(ACE_ROOT)/ace/Service_Repository.i \ - $(ACE_ROOT)/ace/WFMO_Reactor.h \ - $(ACE_ROOT)/ace/WFMO_Reactor.i \ - $(ACE_ROOT)/ace/Strategies.i \ - $(ACE_ROOT)/ace/Message_Queue.i \ - $(ACE_ROOT)/ace/Task_T.i \ - $(ACE_ROOT)/ace/Task_T.cpp \ - $(ACE_ROOT)/ace/Module.h \ - $(ACE_ROOT)/ace/Module.i \ - $(ACE_ROOT)/ace/Module.cpp \ - $(ACE_ROOT)/ace/Stream_Modules.h \ - $(ACE_ROOT)/ace/Stream_Modules.i \ - $(ACE_ROOT)/ace/Stream_Modules.cpp - -.obj/test_signals_1.o .obj/test_signals_1.so .shobj/test_signals_1.o .shobj/test_signals_1.so: test_signals_1.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/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.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/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h - -.obj/test_signals_2.o .obj/test_signals_2.so .shobj/test_signals_2.o .shobj/test_signals_2.so: test_signals_2.cpp \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/WFMO_Reactor.h \ - $(ACE_ROOT)/ace/Message_Queue.h \ - $(ACE_ROOT)/ace/Message_Block.h \ - $(ACE_ROOT)/ace/Message_Block.i \ - $(ACE_ROOT)/ace/Message_Block_T.h \ - $(ACE_ROOT)/ace/Message_Block_T.i \ - $(ACE_ROOT)/ace/Message_Block_T.cpp \ - $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ - $(ACE_ROOT)/ace/Message_Queue_T.h \ - $(ACE_ROOT)/ace/Message_Queue_T.i \ - $(ACE_ROOT)/ace/Message_Queue_T.cpp \ - $(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/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Service_Config.i \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/Synch_Options.h \ - $(ACE_ROOT)/ace/Synch_Options.i \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(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/Managed_Object.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager.h \ - $(ACE_ROOT)/ace/Functor.h \ - $(ACE_ROOT)/ace/Functor.i \ - $(ACE_ROOT)/ace/Functor_T.h \ - $(ACE_ROOT)/ace/Functor_T.i \ - $(ACE_ROOT)/ace/Functor_T.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Strategies_T.i \ - $(ACE_ROOT)/ace/Strategies_T.cpp \ - $(ACE_ROOT)/ace/Service_Repository.h \ - $(ACE_ROOT)/ace/Service_Types.h \ - $(ACE_ROOT)/ace/Service_Types.i \ - $(ACE_ROOT)/ace/Service_Repository.i \ - $(ACE_ROOT)/ace/Strategies.i \ - $(ACE_ROOT)/ace/Message_Queue.i \ - $(ACE_ROOT)/ace/WFMO_Reactor.i \ - $(ACE_ROOT)/ace/Select_Reactor.h \ - $(ACE_ROOT)/ace/Select_Reactor_T.h \ - $(ACE_ROOT)/ace/Select_Reactor_Base.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_Base.i \ - $(ACE_ROOT)/ace/Select_Reactor_T.cpp \ - $(ACE_ROOT)/ace/Timer_Heap.h \ - $(ACE_ROOT)/ace/Timer_Heap_T.h \ - $(ACE_ROOT)/ace/Timer_Heap_T.cpp \ - $(ACE_ROOT)/ace/Select_Reactor_T.i \ - $(ACE_ROOT)/ace/Select_Reactor.i - -.obj/test_time_value.o .obj/test_time_value.so .shobj/test_time_value.o .shobj/test_time_value.so: test_time_value.cpp \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Record.h \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i - -.obj/test_early_timeouts.o .obj/test_early_timeouts.so .shobj/test_early_timeouts.o .shobj/test_early_timeouts.so: test_early_timeouts.cpp \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Pipe.h \ - $(ACE_ROOT)/ace/Pipe.i - -.obj/test_timer_queue.o .obj/test_timer_queue.so .shobj/test_timer_queue.o .shobj/test_timer_queue.so: test_timer_queue.cpp \ - $(ACE_ROOT)/ace/Timer_Heap.h \ - $(ACE_ROOT)/ace/Timer_Heap_T.h \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Malloc_T.cpp \ - $(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/Signal.i \ - $(ACE_ROOT)/ace/Timer_Heap_T.cpp \ - $(ACE_ROOT)/ace/Timer_List.h \ - $(ACE_ROOT)/ace/Timer_List_T.h \ - $(ACE_ROOT)/ace/Timer_List_T.cpp \ - $(ACE_ROOT)/ace/Timer_Queue.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Reactor/Misc/Misc.dsp b/examples/Reactor/Misc/Misc.dsp deleted file mode 100644 index 63265406c26..00000000000 --- a/examples/Reactor/Misc/Misc.dsp +++ /dev/null @@ -1,70 +0,0 @@ -# Microsoft Developer Studio Project File - Name="timer_queue" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=timer_queue - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Misc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Misc.mak" CFG="timer_queue - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "timer_queue - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\timer_queue\Debug"
-# PROP BASE Intermediate_Dir ".\timer_queue\Debug"
-# PROP BASE Target_Dir ".\timer_queue"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ".\timer_queue"
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "timer_queue - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\test_timer_queue.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Misc/Misc.dsw b/examples/Reactor/Misc/Misc.dsw deleted file mode 100644 index 0abd27701e4..00000000000 --- a/examples/Reactor/Misc/Misc.dsw +++ /dev/null @@ -1,101 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "demuxing"=.\demuxing.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "early_timeouts"=.\early_timeouts.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "notification"=.\notification.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "reactors"=.\reactors.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "signals_1"=.\signals_1.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "signals_2"=.\signals_2.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "timer_queue"=.\Misc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/Reactor/Misc/demuxing.dsp b/examples/Reactor/Misc/demuxing.dsp deleted file mode 100644 index 1e56284a4d4..00000000000 --- a/examples/Reactor/Misc/demuxing.dsp +++ /dev/null @@ -1,101 +0,0 @@ -# Microsoft Developer Studio Project File - Name="demuxing" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=demuxing - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "demuxing.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "demuxing.mak" CFG="demuxing - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "demuxing - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "demuxing - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "demuxing - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 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 /machine:I386
-# ADD 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 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 /machine:I386
-
-!ELSEIF "$(CFG)" == "demuxing - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "demuxing___Win32_Debug"
-# PROP BASE Intermediate_Dir "demuxing___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 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 /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "demuxing - Win32 Release"
-# Name "demuxing - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\test_demuxing.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Misc/early_timeouts.dsp b/examples/Reactor/Misc/early_timeouts.dsp deleted file mode 100644 index a92c0da6372..00000000000 --- a/examples/Reactor/Misc/early_timeouts.dsp +++ /dev/null @@ -1,57 +0,0 @@ -# Microsoft Developer Studio Project File - Name="early_timeouts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=early_timeouts - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "early_timeouts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "early_timeouts.mak" CFG="early_timeouts - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "early_timeouts - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "early_ti"
-# PROP BASE Intermediate_Dir "early_ti"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "early_timeouts - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_early_timeouts.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Misc/notification.cpp b/examples/Reactor/Misc/notification.cpp deleted file mode 100644 index 556ed24089b..00000000000 --- a/examples/Reactor/Misc/notification.cpp +++ /dev/null @@ -1,382 +0,0 @@ -// $Id$ - -#include "ace/Service_Config.h" -#include "ace/Thread_Manager.h" -#include "ace/Thread.h" -#include "ace/Synch_T.h" - -ACE_RCSID(Misc, notification, "$Id$") - -#if defined (ACE_HAS_THREADS) -#if defined (CHORUS) -// Chorus does not have signal, so we'll stop after a number of rounds. -#define MAX_ITERATIONS 3 -#else -#define MAX_ITERATIONS 10000 -#endif /* CHORUS */ - -class Thread_Handler : public ACE_Event_Handler -{ - // = TITLE - // Illustrate how the ACE_Reactor's thread-safe event notification - // mechanism works. - // - // = DESCRIPTION - // Handle timeouts in the main thread via the ACE_Reactor and I/O - // events in a separate thread. Just before the separate I/O - // thread exits it notifies the ACE_Reactor in the main thread - // using the ACE_Reactor's notification mechanism. -public: - Thread_Handler (int delay, - int interval, - size_t n_threads, - size_t max_iterations); - // Constructor. - - Thread_Handler (size_t id, - size_t max_iterations); - - ~Thread_Handler (void); - // Destructor. - - virtual int handle_signal (int signum, - siginfo_t * = 0, - ucontext_t * = 0); - // Handle signals. - - virtual int handle_exception (ACE_HANDLE); - // Print data from main thread. - - virtual int handle_output (ACE_HANDLE); - // Print data from main thread. - - virtual int handle_timeout (const ACE_Time_Value &, - const void *); - // Handle timeout events in the main thread. - - virtual int handle_input (ACE_HANDLE); - // General notification messages to the Reactor. - - virtual int notify (ACE_Time_Value *tv = 0); - // Perform notifications. - - virtual int svc (void); - // Handle I/O events in a separate threads. - -private: - static void *svc_run (void *); - // Glues C++ to C thread library functions. - - size_t id_; - // ID passed in by Thread_Handler constructor. - - int iterations_; - - static sig_atomic_t shutdown_; - // Shutting down. - - // = Timing variables. - // Delay factor for timer-driven I/O. - static ACE_Time_Value delay_; - - // Interval factor for Event_Handler timer. - static ACE_Time_Value interval_; -}; - -// Shutdown flag. -sig_atomic_t Thread_Handler::shutdown_ = 0; - -// Delay factor for timer-driven I/O. -ACE_Time_Value Thread_Handler::delay_; - -// Interval factor for Event_Handler timer. -ACE_Time_Value Thread_Handler::interval_; - -Thread_Handler::Thread_Handler (size_t id, - size_t max_iterations) - : id_ (id), - iterations_ (max_iterations) -{ -} - -Thread_Handler::~Thread_Handler (void) -{ - // Cleanup resources so that we don't crash and burn when shutdown. - ACE_Event_Handler::remove_stdin_handler (ACE_Reactor::instance (), - ACE_Thread_Manager::instance ()); - ACE_Reactor::instance ()->cancel_timer (this); -} - -Thread_Handler::Thread_Handler (int delay, - int interval, - size_t n_threads, - size_t max_iterations) - : iterations_ (max_iterations) -{ - ACE_Sig_Set sig_set; - - sig_set.sig_add (SIGQUIT); - sig_set.sig_add (SIGINT); - - delay_.set (delay); - interval_.set (interval); - this->id_ = 0; - - if (ACE_Event_Handler::register_stdin_handler (this, - ACE_Reactor::instance (), - ACE_Thread_Manager::instance ()) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "register_stdin_handler")); - else if (ACE_Reactor::instance ()->register_handler (sig_set, - this) == -1) - ACE_ERROR ((LM_ERROR, - "(%t) %p\n", - "register_handler")); - else if (ACE_Reactor::instance ()->schedule_timer - (this, - 0, - Thread_Handler::delay_, - Thread_Handler::interval_) == -1) - ACE_ERROR ((LM_ERROR, - "(%t) %p\n", - "schedule_timer")); - - // Set up this thread's signal mask to block all the signal in the - // <sig_set>, which is inherited by the threads it spawns. - ACE_Sig_Guard guard (&sig_set); - - // Create N new threads of control Thread_Handlers. - - for (size_t i = 0; i < n_threads; i++) - { - Thread_Handler *th; - - ACE_NEW (th, - Thread_Handler (i + 1, - this->iterations_)); - - if (ACE_Thread::spawn (ACE_reinterpret_cast (ACE_THR_FUNC, - &Thread_Handler::svc_run), - ACE_reinterpret_cast (void *, th), - THR_NEW_LWP | THR_DETACHED) != 0) - ACE_ERROR ((LM_ERROR, - "%p\n", - "ACE_Thread::spawn")); - } - - // The destructor of <guard> unblocks the signal set so that only - // this thread receives them! -} - -int -Thread_Handler::notify (ACE_Time_Value *timeout) -{ - // Just do something to test the ACE_Reactor's multi-thread - // capabilities... - - if (ACE_Reactor::instance ()->notify - (this, - ACE_Event_Handler::EXCEPT_MASK, - timeout) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%t) %p\n", - "notification::notify:exception"), - -1); - else if (ACE_Reactor::instance ()->notify - (this, - ACE_Event_Handler::WRITE_MASK, - timeout) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%t) %p\n", - "notification::notify:write"), - -1); - return 0; -} - -// Test stdin handling that uses <select> to demultiplex HANDLEs. -// Input is only handled by the main thread. - -int -Thread_Handler::handle_input (ACE_HANDLE handle) -{ - char buf[BUFSIZ]; - ssize_t n = ACE_OS::read (handle, buf, sizeof buf); - - if (n > 0) - { - ACE_DEBUG ((LM_DEBUG, - "input to (%t) %*s", - n, - buf)); - - ACE_DEBUG ((LM_DEBUG, - "%d more input to kill\n", - this->iterations_)); - - // Only wait up to 10 milliseconds to notify the Reactor. - ACE_Time_Value timeout (0, - 10 * 1000); - - if (this->notify (&timeout) == -1) - ACE_ERROR ((LM_DEBUG, - "(%t), %p\n", - "notification::handle_input:notify")); - return 0; - } - else - return -1; -} - -// Perform a task that will test the ACE_Reactor's multi-threading -// capabilities in separate threads. - -int -Thread_Handler::svc (void) -{ - ACE_Time_Value sleep_timeout (0, - // Transform this into microseconds and divide by 2. - (Thread_Handler::interval_.sec () * ACE_ONE_SECOND_IN_USECS) / 2); - - for (int i = this->iterations_; - i > 0; - --i) - { - if (this->shutdown_ != 0) - break; - - // Block for delay_.secs () / 2, then notify the Reactor. - ACE_OS::sleep (sleep_timeout); - - // Wait up to 10 milliseconds to notify the Reactor. - ACE_Time_Value timeout (0, - 10 * 1000); - if (this->notify (&timeout) == -1) - ACE_ERROR ((LM_ERROR, - "(%t) %p\n", - "notify")); - } - - ACE_Reactor::instance ()->remove_handler (this, - ALL_EVENTS_MASK); - ACE_DEBUG ((LM_DEBUG, - "(%t) exiting svc\n")); - return 0; -} - -// Test signal handling. - -int -Thread_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - // @@ Note that this code is not portable to all OS platforms since - // it uses print statements within signal handler context. - ACE_DEBUG ((LM_DEBUG, - "(%t) received signal %S\n", - signum)); - - switch (signum) - { - case SIGINT: - case SIGQUIT: - ACE_ERROR ((LM_ERROR, - "(%t) ******************** shutting down %n on signal %S\n", - signum)); - this->shutdown_ = 1; - ACE_Reactor::end_event_loop(); - } - return 0; -} - -int -Thread_Handler::handle_timeout (const ACE_Time_Value &time, - const void *) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) received timeout at (%u, %u), iterations = %d\n", - time.sec (), - time.usec (), - this->iterations_)); - - if (--this->iterations_ <= 0 - || Thread_Handler::interval_.sec () == 0) - ACE_Reactor::end_event_loop (); - - return 0; -} - -// Called by the ACE_Reactor when it receives a notification. - -int -Thread_Handler::handle_exception (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) exception to id %d, iteration = %d\n", - this->id_, - this->iterations_)); - return 0; -} - -// Called by the ACE_Reactor when it receives a notification. - -int -Thread_Handler::handle_output (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) output to id %d, iteration = %d\n", - this->id_, - // This decrement must come last since - // <handle_exception> is called before <handle_output>! - this->iterations_--)); - return 0; -} - -// "Shim" function that integrates C thread API with C++. - -void * -Thread_Handler::svc_run (void *eh) -{ - Thread_Handler *this_handler = - ACE_reinterpret_cast (Thread_Handler *, eh); - - if (this_handler->svc () == 0) - return 0; - else - return ACE_reinterpret_cast (void *, -1); -} - -int -main (int argc, char *argv[]) -{ - ACE_LOG_MSG->open (argv[0]); - - if (argc < 4) - ACE_ERROR ((LM_ERROR, - "usage: %s delay interval n_threads [iterations]%a\n", - argv[0], - 1)); - - int delay = ACE_OS::atoi (argv[1]); - int interval = ACE_OS::atoi (argv[2]); - size_t n_threads = ACE_OS::atoi (argv[3]); - size_t max_iterations = argc > 4 ? ACE_OS::atoi (argv[4]) : MAX_ITERATIONS; - - Thread_Handler thr_handler (delay, - interval, - n_threads, - max_iterations); - - ACE_Reactor::run_event_loop (); - - ACE_DEBUG ((LM_DEBUG, - "exiting from main\n")); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "threads must be supported to run this application\n"), -1); -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Reactor/Misc/notification.dsp b/examples/Reactor/Misc/notification.dsp deleted file mode 100644 index 5670abfe2d0..00000000000 --- a/examples/Reactor/Misc/notification.dsp +++ /dev/null @@ -1,70 +0,0 @@ -# Microsoft Developer Studio Project File - Name="notification" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=notification - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "notification.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "notification.mak" CFG="notification - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "notification - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\notification\Debug"
-# PROP BASE Intermediate_Dir ".\notification\Debug"
-# PROP BASE Target_Dir ".\notification"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ".\notification"
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "notification - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\notification.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Misc/pingpong.cpp b/examples/Reactor/Misc/pingpong.cpp deleted file mode 100644 index 13683c0ab33..00000000000 --- a/examples/Reactor/Misc/pingpong.cpp +++ /dev/null @@ -1,292 +0,0 @@ -// $Id$ - -/* Simple program that illustrates many features of the ACE_Reactor: - - 1. I/O event demultiplexing - 2. Signal-based demultiplexing - 3. Timer-based demultiplexing - - To test this program, compile it and then execute it as follows: - - % ./pingpong hello - - You should see lots of the following output: - - writing <4> [7860] - writing <4> [7860] - writing <4> [7860] - writing <4> [7860] - reading <5> (7860) [1] = hello - writing <4> [7860] - writing <5> [7861] - reading <4> (7861) [2] = hello - reading <5> (7860) [2] = hello - writing <4> [7860] - writing <5> [7861] - reading <4> (7861) [3] = hello - reading <5> (7860) [3] = hello - - After 10 seconds you'll see the following: - - ./pingpong: shutting down tester (pid = 7861) - ./pingpong: shutting down tester (pid = 7860) - - and the program will stop. If you'd like to - stop it earlier, just hit the control-C sequence - and you'll see the same messages. */ - -#include "ace/Synch.h" -#include "ace/Reactor.h" -#include "ace/Pipe.h" - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Test_and_Set<ACE_Null_Mutex, sig_atomic_t>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Test_and_Set<ACE_Null_Mutex, sig_atomic_t> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -ACE_RCSID(Misc, pingpong, "$Id$") - -class Ping_Pong : public ACE_Test_and_Set<ACE_Null_Mutex, sig_atomic_t> -{ -public: - Ping_Pong (char b[], ACE_HANDLE f); - virtual ACE_HANDLE get_handle (void) const; - virtual int handle_input (ACE_HANDLE); - virtual int handle_output (ACE_HANDLE); - virtual int handle_timeout (const ACE_Time_Value &, - const void *); - -private: - char buf_[BUFSIZ]; - // Buffer to send. - - size_t buflen_; - // Length of the buffer to send. - - int pid_; - // Process ID. - - ACE_HANDLE handle_; - // Open handle. -}; - -Ping_Pong::Ping_Pong (char b[], ACE_HANDLE f) - : buflen_ (ACE_OS::strlen (b) + 1 + (2 * sizeof (int))), - pid_ (ACE_OS::getpid ()), - handle_ (f) -{ - *((int *) this->buf_) = (int) this->pid_; - *((int *) (this->buf_ + sizeof (int))) = 0; - ACE_OS::strcpy (this->buf_ + (2 * sizeof (int)), b); - this->buf_[this->buflen_ - 1] = '\n'; - this->buf_[this->buflen_] = '\0'; -} - -ACE_HANDLE -Ping_Pong::get_handle (void) const -{ - return this->handle_; -} - -int -Ping_Pong::handle_input (ACE_HANDLE) -{ -#if defined (ACE_HAS_STREAM_PIPES) - // We can rely on record-oriented reads... - - ssize_t n = ACE::recv (this->handle_, this->buf_, this->buflen_); - - if (n != (ssize_t) this->buflen_) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) reading [%d] %p\n", - handle_, - "read"), - -1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reading <%d> (%d) [%d] = %s\n", - this->handle_, - *(int *) this->buf_, - *(int *) (this->buf_ + sizeof (int)), - this->buf_ + (2 * sizeof (int)))); -#else - ssize_t n = ACE::recv (this->handle_, - this->buf_, - this->buflen_); - if (n == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "[%d] %p\n", - handle_, - "read"), - -1); - n -= (2 * sizeof (int)); - char *buf = this->buf_ + (2 * sizeof (int)); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reading <%d> = %*s\n", - this->handle_, - n, - buf)); -#endif /* ACE_HAS_STREAM_PIPES */ - return 0; -} - -int -Ping_Pong::handle_output (ACE_HANDLE) -{ -#if defined (ACE_HAS_STREAM_PIPES) - // We can rely on record-oriented reads... - - (*(int *) (this->buf_)) = this->pid_; - (*(int *) (this->buf_ + sizeof (int)))++; - if (ACE::send (this->handle_, - this->buf_, - this->buflen_) == -1) - return -1; - else - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) writing <%d> [%d]\n", - this->handle_, - this->pid_)); - return 0; - } -#else - if (ACE::send (this->handle_, - this->buf_, - this->buflen_) == -1) - return -1; - else - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) writing <%d>\n", - this->handle_)); - return 0; - } -#endif /* ACE_HAS_STREAM_PIPES */ -} - -int -Ping_Pong::handle_timeout (const ACE_Time_Value &, - const void *) -{ - this->set (1); - return 0; -} - -// Contains the string to "pingpong" back and forth... -static char *string_name; - -// Wait for 10 seconds and then shut down. -static const int SHUTDOWN_TIME = 10; - -static void -run_svc (ACE_HANDLE handle) -{ - // The <callback> object is an <ACE_Event_Handler> created on the - // stack. This is normally not a good idea, but in this case it - // works because the ACE_Reactor is destroyed before leaving this - // scope as well, so it'll remove the <callback> object from its - // internal tables BEFORE it is destroyed. - Ping_Pong callback (string_name, handle); - - // Note that we put the <reactor> AFTER the <callback> so that the - // <reactor> will get shutdown first. - ACE_Reactor reactor; - - // Register the callback object for the various I/O, signal, and - // timer-based events. - - if (reactor.register_handler (&callback, - ACE_Event_Handler::READ_MASK - | ACE_Event_Handler::WRITE_MASK) == -1 -#if !defined (CHORUS) - || reactor.register_handler (SIGINT, - &callback) == -1 -#endif /* CHORUS */ - || reactor.schedule_timer (&callback, - 0, - SHUTDOWN_TIME) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n%a", - "reactor", - 1)); - - // Main event loop (one per process). - - while (callback.is_set () == 0) - if (reactor.handle_events () == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "handle_events")); -} - -#if defined (ACE_WIN32) || defined (CHORUS) -static ACE_Barrier barrier (3); - -static void * -worker (void *arg) -{ - ACE_HANDLE handle = (ACE_HANDLE) arg; - - run_svc (handle); - - // Wait for the threads to exit. - barrier.wait (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %n: shutting down tester\n")); - return 0; -} -#endif /* ACE_WIN32 */ - -int -main (int argc, char *argv[]) -{ - ACE_LOG_MSG->open (argv[0]); - - if (argc != 2) - ACE_ERROR ((LM_ERROR, - "usage: %n string\n%a", - 1)); - - string_name = argv[1]; - - ACE_HANDLE handles[2]; - - // Create a pipe and initialize the handles. - ACE_Pipe pipe (handles); - -#if defined (ACE_WIN32) || defined (CHORUS) - if (ACE_Thread::spawn (ACE_THR_FUNC (worker), - (void *) handles[0], - THR_DETACHED) == -1 - || ACE_Thread::spawn (ACE_THR_FUNC (worker), - (void *) handles[1], - THR_DETACHED) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n%a", - "spawn", - 1)); - barrier.wait (); -#else - pid_t pid = ACE_OS::fork (argv[0]); - - if (pid == -1) - ACE_ERROR ((LM_ERROR, - "%p\n%a", - "fork", - 1)); - run_svc (handles[pid == 0]); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %n: shutting down tester\n")); -#endif /* ACE_WIN32 */ - - if (pipe.close () == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "close")); - return 0; -} diff --git a/examples/Reactor/Misc/reactors.dsp b/examples/Reactor/Misc/reactors.dsp deleted file mode 100644 index 65421c32ce7..00000000000 --- a/examples/Reactor/Misc/reactors.dsp +++ /dev/null @@ -1,57 +0,0 @@ -# Microsoft Developer Studio Project File - Name="reactors" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=reactors - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "reactors.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "reactors.mak" CFG="reactors - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "reactors - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "reactors"
-# PROP BASE Intermediate_Dir "reactors"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "reactors - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_reactors.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Misc/signal_tester.cpp b/examples/Reactor/Misc/signal_tester.cpp deleted file mode 100644 index 37613f14f38..00000000000 --- a/examples/Reactor/Misc/signal_tester.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// Perform an extensive test of the ACE_Reactor's event dispatching -// $Id$ - -// mechanisms. These mechanisms illustrate how signals, I/O, and -// timeout events can all be handled within the same framework. In -// addition, this example illustrates how to use the ACE_Reactor for -// devices that perform I/O via signals (such as SVR4 message queues). - - -#include "ace/Service_Config.h" - -// Used to shut down the event loop. -static sig_atomic_t done = 0; - -// This class illustrates how to handle signal-driven I/O using the -// ACE_Reactor framework. Note that signals may be caught and -// processed without requiring the use of global signal handler -// functions or global signal handler data. - -class Sig_Handler : public ACE_Event_Handler -{ -public: - Sig_Handler (void); - virtual ACE_HANDLE get_handle (void) const; - virtual int handle_input (ACE_HANDLE); - virtual int shutdown (ACE_HANDLE, ACE_Reactor_Mask); - virtual int handle_signal (ACE_HANDLE signum, siginfo_t * = 0, - ucontext_t * = 0); - -private: - ACE_HANDLE handle_; -}; - -// A dummy_handle is required to reserve a slot in the ACE_Reactor's -// descriptor table. - -Sig_Handler::Sig_Handler (void) -{ - // Assign the Sig_Handler a dummy I/O descriptor. Note that even - // though we open this file "Write Only" we still need to use the - // ACE_Event_Handler::NULL_MASK when registering this with the - // ACE_Reactor (see below). - this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY); - ACE_ASSERT (this->handle_ != -1); - - // Register signal handler object. Note that NULL_MASK is used to - // keep the ACE_Reactor from calling us back on the "/dev/null" - // descriptor. - if (ACE_Service_Config::reactor ()->register_handler - (this, ACE_Event_Handler::NULL_MASK) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1)); - - // Create a sigset_t corresponding to the signals we want to catch. - ACE_Sig_Set sig_set; - - sig_set.sig_add (SIGINT); - sig_set.sig_add (SIGQUIT); - sig_set.sig_add (SIGALRM); - - // Register the signal handler object to catch the signals. - if (ACE_Service_Config::reactor ()->register_handler (sig_set, this) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1)); -} - -// Called by the ACE_Reactor to extract the fd. - -ACE_HANDLE -Sig_Handler::get_handle (void) const -{ - return this->handle_; -} - -// In a real application, this method would be where the read on the -// signal-driven I/O device would occur asynchronously. For now we'll -// just print a greeting to let you know that everything is working -// properly! - -int -Sig_Handler::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, "handling asynchonrous input...\n")); - return 0; -} - -// In a real application, this method would do any cleanup activities -// required when shutting down the I/O device. - -int -Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "closing down Sig_Handler...\n")); - return 0; -} - -// This method handles all the signals that are being caught by this -// object. In our simple example, we are simply catching SIGALRM, -// SIGINT, and SIGQUIT. Anything else is logged and ignored. -// -// There are several advantages to using this approach. First, -// the behavior triggered by the signal is handled in the main event -// loop, rather than in the signal handler. Second, the ACE_Reactor's -// signal handling mechanism eliminates the need to use global signal -// handler functions and data. - -int -Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - ACE_DEBUG ((LM_DEBUG, "received signal %S\n", signum)); - - switch (signum) - { - case SIGALRM: - // Rearm the alarm. - ACE_OS::alarm (4); - break; - case SIGINT: - // Tell the ACE_Reactor to enable the ready bit for - // this->handle_. The ACE_Reactor will subsequently call the - // Sig_Handler::handle_input method from within its event loop. - return ACE_Service_Config::reactor ()->ready_ops - (this->handle_, ACE_Event_Handler::READ_MASK, ACE_Reactor::ADD_MASK); - case SIGQUIT: - ACE_DEBUG ((LM_DEBUG, "%S: shutting down signal tester\n", signum)); - ACE_Service_Config::end_reactor_event_loop (); - break; - default: - ACE_DEBUG ((LM_DEBUG, - "%S: not handled, returning to program\n", signum)); - break; - } - return 0; -} - -// This class illustrates that the ACE_Reactor can handle signals, -// STDIO, and timeouts using the same mechanisms. - -class STDIN_Handler : public ACE_Event_Handler -{ -public: - STDIN_Handler (void); - virtual int handle_input (ACE_HANDLE); - virtual int handle_timeout (const ACE_Time_Value &, - const void *arg); -}; - -STDIN_Handler::STDIN_Handler (void) -{ - if (ACE::register_stdin_handler (this, - ACE_Service_Config::reactor (), - ACE_Service_Config::thr_mgr ()) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler")); - - // Register the STDIN_Handler to be dispatched once every second. - else if (ACE_Service_Config::reactor ()->schedule_timer - (this, 0, ACE_Time_Value (1), ACE_Time_Value (1)) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "schedule_timer", 1)); -} - -int -STDIN_Handler::handle_timeout (const ACE_Time_Value &tv, - const void *) -{ - ACE_DEBUG ((LM_DEBUG, "timeout occurred at %d sec, %d usec\n", - tv.sec (), tv.usec ())); - return 0; -} - -// Read from input descriptor and write to stdout descriptor. - -int -STDIN_Handler::handle_input (ACE_HANDLE handle) -{ - ssize_t n; - char buf[BUFSIZ]; - - switch (n = ACE_OS::read (handle, buf, sizeof buf)) - { - case -1: - if (errno == EINTR) - return 0; - /* NOTREACHED */ - else - ACE_ERROR ((LM_ERROR, "%p\n", "read")); - /* FALLTHROUGH */ - case 0: - ACE_Service_Config::end_reactor_event_loop (); - break; - default: - { - ssize_t result = ACE::write_n (ACE_STDOUT, buf, n); - - if (result != n) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write"), - result == -1 && errno == EINTR ? 0 : -1); - } - } - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon (argv [0]); - - // Signal handler. - Sig_Handler sh; - - // Define an I/O handler object. - STDIN_Handler ioh; - - // Optionally start the alarm. - if (argc > 1) - ACE_OS::alarm (4); - - // Loop handling signals and I/O events until SIGQUIT occurs. - - while (daemon.reactor_event_loop_done () == 0) - daemon.run_reactor_event_loop (); - - return 0; -} diff --git a/examples/Reactor/Misc/signals_1.dsp b/examples/Reactor/Misc/signals_1.dsp deleted file mode 100644 index 10dbee350aa..00000000000 --- a/examples/Reactor/Misc/signals_1.dsp +++ /dev/null @@ -1,57 +0,0 @@ -# Microsoft Developer Studio Project File - Name="signals_1" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=signals_1 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "signals_1.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "signals_1.mak" CFG="signals_1 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "signals_1 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "signals_"
-# PROP BASE Intermediate_Dir "signals_"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "signals_1 - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_signals_1.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Misc/signals_2.dsp b/examples/Reactor/Misc/signals_2.dsp deleted file mode 100644 index 8f14dcdb9c4..00000000000 --- a/examples/Reactor/Misc/signals_2.dsp +++ /dev/null @@ -1,57 +0,0 @@ -# Microsoft Developer Studio Project File - Name="signals_2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=signals_2 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "signals_2.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "signals_2.mak" CFG="signals_2 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "signals_2 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "signals_"
-# PROP BASE Intermediate_Dir "signals_"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "signals_2 - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_signals_2.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Misc/test_demuxing.cpp b/examples/Reactor/Misc/test_demuxing.cpp deleted file mode 100644 index 345ffc85a95..00000000000 --- a/examples/Reactor/Misc/test_demuxing.cpp +++ /dev/null @@ -1,380 +0,0 @@ -// $Id$ - -// Perform an extensive test of all the ACE_Reactor's event handler -// dispatching mechanisms. These mechanisms illustrate how I/O, -// timeout, and signal events, as well as ACE_Message_Queues, can all -// be handled within the same demultiplexing and dispatching -// framework. In addition, this example illustrates how to use the -// ACE_Reactor for devices that perform I/O via signals (such as SVR4 -// message queues). - -#include "ace/Service_Config.h" -#include "ace/Task.h" - -ACE_RCSID(Misc, test_demuxing, "$Id$") - -// Default is to have a 2 second timeout. -static int timeout = 2; - -class Sig_Handler : public ACE_Event_Handler -{ - // = TITLE - // This class illustrates how to handle signal-driven I/O using - // the <ACE_Reactor> framework. Note that signals may be caught - // and processed without requiring the use of global signal - // handler functions or global signal handler data. -public: - Sig_Handler (void); - virtual ACE_HANDLE get_handle (void) const; - virtual int handle_input (ACE_HANDLE); - virtual int shutdown (ACE_HANDLE, ACE_Reactor_Mask); - virtual int handle_signal (int signum, siginfo_t * = 0, - ucontext_t * = 0); - -private: - ACE_HANDLE handle_; -}; - -// A dummy_handle is required to reserve a slot in the ACE_Reactor's -// descriptor table. - -Sig_Handler::Sig_Handler (void) -{ - // Assign the Sig_Handler a dummy I/O descriptor. Note that even - // though we open this file "Write Only" we still need to use the - // ACE_Event_Handler::NULL_MASK when registering this with the - // ACE_Reactor (see below). - this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY); - ACE_ASSERT (this->handle_ != ACE_INVALID_HANDLE); - - // Register signal handler object. Note that NULL_MASK is used to - // keep the ACE_Reactor from calling us back on the "/dev/null" - // descriptor. NULL_MASK just reserves a "slot" in the Reactor's - // internal demuxing table, but doesn't cause it to dispatch the - // event handler directly. Instead, we use the signal handler to do - // this. - if (ACE_Reactor::instance ()->register_handler - (this, - ACE_Event_Handler::NULL_MASK) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n%a", - "register_handler", - 1)); - - // Create a sigset_t corresponding to the signals we want to catch. - ACE_Sig_Set sig_set; - - sig_set.sig_add (SIGINT); - sig_set.sig_add (SIGQUIT); - sig_set.sig_add (SIGALRM); - - // Register the signal handler object to catch the signals. - if (ACE_Reactor::instance ()->register_handler - (sig_set, this) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n%a", - "register_handler", - 1)); -} - -// Called by the ACE_Reactor to extract the handle. - -ACE_HANDLE -Sig_Handler::get_handle (void) const -{ - return this->handle_; -} - -// In a real application, this method would be where the read on the -// signal-driven I/O device would occur asynchronously. For now we'll -// just print a greeting to let you know that everything is working -// properly! - -int -Sig_Handler::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) handling asynchonrous input...\n")); - return 0; -} - -// In a real application, this method would do any cleanup activities -// required when shutting down the I/O device. - -int -Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) closing down Sig_Handler...\n")); - return 0; -} - -// This method handles all the signals that are being caught by this -// object. In our simple example, we are simply catching SIGALRM, -// SIGINT, and SIGQUIT. Anything else is logged and ignored. -// -// There are several advantages to using this approach. First, the -// behavior triggered by the signal is handled in the main event loop, -// rather than in the signal handler. Second, the ACE_Reactor's -// signal handling mechanism eliminates the need to use global signal -// handler functions and data. - -int -Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - switch (signum) - { -#if !defined (ACE_WIN32) - case SIGALRM: - // Rearm the alarm. - ACE_OS::alarm (4); - break; -#endif /* !ACE_WIN32 */ - case SIGINT: - // Tell the ACE_Reactor to enable the ready bit for - // this->handle_. The ACE_Reactor will subsequently call the - // <Sig_Handler::handle_input> method from within its event - // loop. - return ACE_Reactor::instance ()->ready_ops - (this->handle_, - ACE_Event_Handler::READ_MASK, - ACE_Reactor::ADD_MASK); -#if defined (ACE_WIN32) - case SIGTERM: -#else - case SIGQUIT: -#endif /* ACE_WIN32 */ - ACE_Reactor::end_event_loop (); - break; - default: - ACE_ASSERT (!"invalid signal"); - break; - /* NOTREACHED */ - } - return 0; -} - -class STDIN_Handler : public ACE_Event_Handler -{ - // = TITLE - // This class illustrates that the ACE_Reactor can handle signals, - // STDIO, and timeouts using the same mechanisms. -public: - STDIN_Handler (void); - ~STDIN_Handler (void); - virtual int handle_input (ACE_HANDLE); - virtual int handle_timeout (const ACE_Time_Value &, - const void *arg); -}; - -STDIN_Handler::STDIN_Handler (void) -{ - if (ACE_Event_Handler::register_stdin_handler (this, - ACE_Reactor::instance (), - ACE_Thread_Manager::instance ()) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "register_stdin_handler")); - - // Register the <STDIN_Handler> to be dispatched once every - // <timeout> seconds starting in <timeout> seconds. This example - // uses the "interval timer" feature of the <ACE_Reactor>'s timer - // queue. - else if (ACE_Reactor::instance ()->schedule_timer - (this, - 0, - ACE_Time_Value (timeout), - ACE_Time_Value (timeout)) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n%a", - "schedule_timer", - 1)); -} - -STDIN_Handler::~STDIN_Handler (void) -{ - if (ACE_Event_Handler::remove_stdin_handler (ACE_Reactor::instance (), - ACE_Thread_Manager::instance ()) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "remove_stdin_handler")); - else if (ACE_Reactor::instance ()->cancel_timer - (this) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n%a", - "cancel_timer", - 1)); -} - -int -STDIN_Handler::handle_timeout (const ACE_Time_Value &tv, - const void *) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) timeout occurred at %d sec, %d usec\n", - tv.sec (), - tv.usec ())); - return 0; -} - -// Read from input handle and write to stdout handle. - -int -STDIN_Handler::handle_input (ACE_HANDLE handle) -{ - char buf[BUFSIZ]; - ssize_t n = ACE_OS::read (handle, buf, sizeof buf); - - switch (n) - { - case -1: - if (errno == EINTR) - return 0; - /* NOTREACHED */ - else - ACE_ERROR ((LM_ERROR, - "%p\n", - "read")); - /* FALLTHROUGH */ - case 0: - ACE_Reactor::end_event_loop (); - break; - default: - { - ssize_t result = ACE::write_n (ACE_STDOUT, buf, n); - - if (result != n) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "write"), - result == -1 && errno == EINTR ? 0 : -1); - } - } - return 0; -} - -class Message_Handler : public ACE_Task <ACE_SYNCH> -{ -public: - Message_Handler (void); - - virtual int handle_input (ACE_HANDLE); - // Called back within the context of the <ACE_Reactor> Singleton to - // dequeue and process the message on the <ACE_Message_Queue>. - - virtual int svc (void); - // Run the "event-loop" periodically putting messages to our - // internal <Message_Queue> that we inherit from <ACE_Task>. - -private: - ACE_Reactor_Notification_Strategy notification_strategy_; - // This strategy will notify the <ACE_Reactor> Singleton when a new - // message is enqueued. -}; - -Message_Handler::Message_Handler (void) - : notification_strategy_ (ACE_Reactor::instance (), - this, - ACE_Event_Handler::READ_MASK) -{ - // Set this to the Reactor notification strategy. - this->msg_queue ()->notification_strategy (&this->notification_strategy_); - - if (this->activate ()) - ACE_ERROR ((LM_ERROR, - "%p\n", - "activate")); -} - -int -Message_Handler::svc (void) -{ - for (int i = 0;; i++) - { - ACE_Message_Block *mb; - - ACE_NEW_RETURN (mb, - ACE_Message_Block (1), - 0); - - mb->msg_priority (i); - ACE_OS::sleep (1); - - // Note that this putq() call with automagically invoke the - // notify() hook of our ACE_Reactor_Notification_Strategy, - // thereby informing the <ACE_Reactor> Singleton to call our - // <handle_input> method. - if (this->putq (mb) == -1) - { - if (errno == ESHUTDOWN) - ACE_ERROR_RETURN ((LM_ERROR, - "(%t) queue is deactivated"), 0); - else - ACE_ERROR_RETURN ((LM_ERROR, - "(%t) %p\n", - "putq"), - -1); - } - } - - ACE_NOTREACHED (return 0); -} - -int -Message_Handler::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) Message_Handler::handle_input\n")); - - ACE_Message_Block *mb; - - if (this->getq (mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) - ACE_ERROR ((LM_ERROR, - "(%t) %p\n", - "dequeue_head")); - else - { - ACE_DEBUG ((LM_DEBUG, - "(%t) priority = %d\n", - mb->msg_priority ())); - mb->release (); - } - - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon (argv [0]); - - // Optionally start the alarm. - if (argc > 1) - { - ACE_OS::alarm (4); - timeout = ACE_OS::atoi (argv[1]); - } - - // Signal handler. - Sig_Handler sh; - - // Define an I/O handler object. - STDIN_Handler ioh; - - // Define a message handler. - Message_Handler mh; - - // Loop handling signals and I/O events until SIGQUIT occurs. - - while (ACE_Reactor::event_loop_done () == 0) - ACE_Reactor::run_event_loop (); - - // Deactivate the message queue. - mh.msg_queue ()->deactivate (); - - // Wait for the thread to exit. - ACE_Thread_Manager::instance ()->wait (); - ACE_DEBUG ((LM_DEBUG, - "(%t) leaving main\n")); - return 0; -} diff --git a/examples/Reactor/Misc/test_early_timeouts.cpp b/examples/Reactor/Misc/test_early_timeouts.cpp deleted file mode 100644 index 697f11a5d7e..00000000000 --- a/examples/Reactor/Misc/test_early_timeouts.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// $Id$ - -// ================================================================ -// -// = LIBRARY -// examples/Reactor/Misc/ -// -// = FILENAME -// test_early_timeouts.cpp -// -// = DESCRIPTION -// On some platforms, select() returns before the time value -// specified. This tests counts the number of times this happens -// and the max early timeout. -// -// = AUTHOR -// Irfan Pyarali -// -// ================================================================ - -#include "ace/Handle_Set.h" -#include "ace/Pipe.h" - -ACE_RCSID(Misc, test_early_timeouts, "$Id$") - -int -main (int, char *[]) -{ - // Mumber of seconds this test should run - int runtime_in_seconds = 10; - - // Iterations - int iterations = runtime_in_seconds * 10; - - // 100 millisecond timeout - ACE_Time_Value timeout (0, 100000); - - // Time before starting select - ACE_Time_Value starting_time_of_day; - - // Time before starting select - ACE_Time_Value ending_time_of_day; - - // Number of times the timer expired early - int no_of_early_timers = 0; - - // Maximum early timeout - ACE_Time_Value maximum_early_timeout; - - // - // Dummy handle and handle set - // Note that some OS do not like "empty selects" - // - - // Dummy handle set - ACE_Handle_Set dummy_handle_set; - - // Dummy pipe - ACE_Pipe dummy_pipe; - int result = dummy_pipe.open (); - ACE_ASSERT (result == 0); - ACE_UNUSED_ARG (result); // To avoid compile warning with ACE_NDEBUG. - - for (int i = 1; i <= iterations; i++) - { - // Add dummy handle to dummy set - dummy_handle_set.set_bit (dummy_pipe.read_handle ()); - - // Note the time before select - starting_time_of_day = ACE_OS::gettimeofday (); - - // Wait for timeout - result = ACE_OS::select ((int) dummy_pipe.read_handle (), dummy_handle_set, 0, 0, &timeout); - ACE_ASSERT (result == 0); - - // Note the time after select - ending_time_of_day = ACE_OS::gettimeofday (); - - // Expected ending time - ACE_Time_Value expected_ending_time_of_day = - starting_time_of_day + timeout; - - // If the timer expired early - if (ending_time_of_day < expected_ending_time_of_day) - { - // How early - ACE_Time_Value early_timeout = expected_ending_time_of_day - ending_time_of_day; - - // Increment number of early timers - no_of_early_timers++; - - // Check max early timeout - if (early_timeout > maximum_early_timeout) - { - maximum_early_timeout = early_timeout; - } - } - } - - ACE_DEBUG ((LM_DEBUG, - "There were %d early timers out of %d calls to select() (%f%%)\n" - "The max early timeout was: %dsec %dusec\n", - no_of_early_timers, - iterations, - float (no_of_early_timers) / iterations * 100, - maximum_early_timeout.sec (), - maximum_early_timeout.usec ())); - - return 0; -} diff --git a/examples/Reactor/Misc/test_event_handler_t.cpp b/examples/Reactor/Misc/test_event_handler_t.cpp deleted file mode 100644 index a1e0e1bc248..00000000000 --- a/examples/Reactor/Misc/test_event_handler_t.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// $Id$ - -#include "ace/Event_Handler_T.h" - -ACE_RCSID(Misc, test_event_handler_t, "$Id$") - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) - -class ACE_Test_Sig_Handler -{ -public: - ACE_Test_Sig_Handler (void) {} - virtual ACE_HANDLE get_handle (void) const { return 0; } - virtual void set_handle (ACE_HANDLE) {} - virtual int handle_async_io (ACE_HANDLE) { return 0; } - virtual int shutdown (ACE_HANDLE, ACE_Reactor_Mask) { return 0; } - virtual int signal_handler (ACE_HANDLE /* signum */, - siginfo_t * = 0, - ucontext_t * = 0) - { - return 0; - } -}; - -int -main (int, char *[]) -{ - typedef ACE_Event_Handler_T<ACE_Test_Sig_Handler> EH_SH; - - // Tie the ACE_Event_Handler_T together with the methods from ACE_Test_Sig_Handler. - EH_SH tied_sh (new ACE_Test_Sig_Handler, 1, - &ACE_Test_Sig_Handler::get_handle, - &ACE_Test_Sig_Handler::handle_async_io, - &ACE_Test_Sig_Handler::shutdown, - &ACE_Test_Sig_Handler::signal_handler); - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ - defined (ACE_HAS_GNU_REPO) - // The explicit instantiation is necessary with g++ 2.91.66 with - // -frepo, because it misses it. -template class ACE_Event_Handler_T<ACE_Test_Sig_Handler>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Event_Handler_T<ACE_Test_Sig_Handler> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#else -int -main (int, char *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, "your platform does not support template typedefs\n"), 1); -} -#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ diff --git a/examples/Reactor/Misc/test_reactors.cpp b/examples/Reactor/Misc/test_reactors.cpp deleted file mode 100644 index 75467c2d4e4..00000000000 --- a/examples/Reactor/Misc/test_reactors.cpp +++ /dev/null @@ -1,200 +0,0 @@ -// $Id$ - -// Perform a torture test of multiple ACE_Reactors and ACE_Tasks in -// the same process... Thanks to Detlef Becker for contributing this. - -#include "ace/Reactor.h" -#include "ace/Synch.h" -#include "ace/Service_Config.h" -#include "ace/Task.h" - -ACE_RCSID(Misc, test_reactors, "$Id$") - -#if defined (ACE_HAS_THREADS) - -static const int NUM_INVOCATIONS = 10; -static const int MAX_TASKS = 20; - -class Test_Task : public ACE_Task<ACE_MT_SYNCH> -{ -public: - Test_Task (void); - ~Test_Task (void); - - virtual int open (void *args = 0); - virtual int close (u_long flags = 0); - virtual int svc (void); - - virtual int handle_input (ACE_HANDLE handle); - virtual int handle_close (ACE_HANDLE fd, - ACE_Reactor_Mask close_mask); - -private: - int handled_; - - static int task_count_; -}; - -int Test_Task::task_count_ = 0; - -static ACE_Atomic_Op<ACE_Thread_Mutex, int> done_count = MAX_TASKS * 2; - -static ACE_Recursive_Thread_Mutex reclock_; - -Test_Task::Test_Task (void) - : handled_ (0) -{ - ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, reclock_); - - Test_Task::task_count_++; - ACE_DEBUG ((LM_DEBUG, - "(%t) TT+ Test_Task::task_count_ = %d\n", - Test_Task::task_count_)); -} - -Test_Task::~Test_Task (void) -{ - ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, reclock_); - - ACE_DEBUG ((LM_DEBUG, - "(%t) TT- Test_Task::task_count_ = %d\n", - Test_Task::task_count_)); -} - -int -Test_Task::open (void *args) -{ - this->reactor ((ACE_Reactor *) args); - return this->activate (THR_NEW_LWP); -} - -int -Test_Task::close (u_long) -{ - ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, reclock_, -1); - - Test_Task::task_count_--; - ACE_DEBUG ((LM_DEBUG, - "(%t) close Test_Task::task_count_ = %d\n", - Test_Task::task_count_)); - return 0; -} - -int -Test_Task::svc (void) -{ - for (int i = 0; i < NUM_INVOCATIONS; i++) - { - ACE_OS::thr_yield (); - - // ACE_DEBUG ((LM_DEBUG, "(%t) calling notify %d\n", i)); - - if (this->reactor ()->notify (this, ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "notify"), -1); - - // ACE_DEBUG ((LM_DEBUG, "(%t) leaving notify %d\n", i)); - } - - return 0; -} - -int -Test_Task::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) handle_close\n")); - return 0; -} - -int -Test_Task::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) handle_input\n")); - - this->handled_++; - - if (this->handled_ == NUM_INVOCATIONS) - { - done_count--; - ACE_DEBUG ((LM_DEBUG, - "(%t) handle_input, handled_ = %d, done_count = %d\n", - this->handled_, done_count.value ())); - } - - ACE_OS::thr_yield (); - return -1; -} - -static void * -worker (void *args) -{ - ACE_Reactor *reactor = (ACE_Reactor *) args; - - reactor->owner (ACE_Thread::self ()); - - ACE_Time_Value timeout (4); - - for (;;) - { - //ACE_DEBUG ((LM_DEBUG, "(%t) calling handle_events\n")); - - switch (reactor->handle_events (timeout)) - { - case -1: - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "reactor"), 0); - /* NOTREACHED */ - case 0: - ACE_ERROR_RETURN ((LM_ERROR, "(%t) timeout\n"), 0); - /* NOTREACHED */ - } - - // ACE_DEBUG ((LM_DEBUG, "(%t) done with handle_events\n")); - - } - - ACE_NOTREACHED(return 0); -} - -int -main (int, char *[]) -{ - ACE_Reactor *react1 = ACE_Reactor::instance (); - ACE_Reactor *react2 = new ACE_Reactor (); - Test_Task tt1[MAX_TASKS]; - Test_Task tt2[MAX_TASKS]; - - for (int i = 0; i < MAX_TASKS; i++) - { - tt1[i].open (react1); - tt2[i].open (react2); - } - - if (ACE_Thread_Manager::instance ()->spawn - (ACE_THR_FUNC (worker), (void *) react1, THR_NEW_LWP) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn"), -1); - - else if (ACE_Thread_Manager::instance ()->spawn - (ACE_THR_FUNC (worker), (void *) react2, THR_NEW_LWP) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn"), -1); - - ACE_Thread_Manager::instance ()->wait (); - ACE_DEBUG ((LM_DEBUG, "(%t) done\n")); - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Reactor/Misc/test_signals.cpp b/examples/Reactor/Misc/test_signals.cpp deleted file mode 100644 index 6493667de12..00000000000 --- a/examples/Reactor/Misc/test_signals.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// Test the ability of the Reactor/Signal_Handler to register multiple -// $Id$ - -// handler per-signal. - -/* This test works as follows: - - 1. To test the "original" semantics of ACE (i.e., only one - ACE_Event_Handler can be registered per signal), you don't - need to do anything special. Existing programs work the - same since giving the Reactor's constructor a 0 value - (which is the default argument, BTW) instructs it to behave - as before. When a 0 is given, the ACE_Reactor's - constructor/open method creates an instance of - ACE_Sig_Handler and assigns this to an internal pointer. - This pointer is then used to dispatch all signal-related - methods within the Reactor. The default ACE_Sig_Handler - only allows *one* ACE_Event_Handler to be registered - per-signal. - - To run this version of the test do the following: - - % ./test-signal - ./test_signals - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 1 - waiting for SIGINT or SIGQUIT - ^\ - signal Quit occurred in Sig_Handler_2 (fruity, 0, 0) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (fruity, 0, 0) - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 3 - waiting for SIGINT or SIGQUIT - ^\Quit (core dumped) - - Note that in this test only one handler (the last one -- - "Sig_Handler_2 (fruity)") is actually registered. BTW, the - core dump is the expected behavior since the default - disposition is restored when there are no more handlers - (see the code below). - - 2. To test the "multiple handlers per-signal semantics", you - need to pass the constructor/open method of the ACE_Reactor - a pointer to a an instance of ACE_Sig_Handlers (note the - plural "s"). ACE_Sig_Handlers is a class that derives from - ACE_Sig_Handler. The difference between these two classes - is that (1) ACE_Sig_Handlers::register_signal allows - multiple ACE_Event_Handlers to be registered per-signal and - (2) it enables SA_RESTART by default. This class also - implements Detlef Becker's algorithm for integrating ACE - signal handling with 3rd party libraries. - - To run this version of the test do the following: - - % ./test_signals 1 - - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in external handler! - signal Interrupt occurred in Sig_Handler_1 (howdy, 3, 1) with count = 1 - shutting down SIGINT in Sig_Handler_1 (howdy, 3, 1) - signal Interrupt occurred in Sig_Handler_1 (doody, 5, 4) with count = 1 - shutting down SIGINT in Sig_Handler_1 (doody, 5, 4) - signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 1 - signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 1 - waiting for SIGINT or SIGQUIT - ^\ - signal Quit occurred in Sig_Handler_1 (howdy, 3, 1) with count = 2 - shutting down SIGQUIT in Sig_Handler_1 (howdy, 3, 1) - signal Quit occurred in Sig_Handler_1 (doody, 5, 4) with count = 2 - shutting down SIGQUIT in Sig_Handler_1 (doody, 5, 4) - signal Quit occurred in Sig_Handler_2 (tutty, 7, 6) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (tutty, 7, 6) - signal Quit occurred in Sig_Handler_2 (fruity, 9, 8) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (fruity, 9, 8) - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in external handler! - signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 3 - signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 3 - waiting for SIGINT or SIGQUIT - ^\Quit (core dumped) - - When this test begins all four handlers are registered and - dispatched when a SIGINT or SIGQUIT occurs. After the - first SIGINT, the handle_signal method of the Sig_Handler_1 - objects unregister themselves. At that point there are 4 - SIGQUIT handlers left, but only 2 of our SIGINT handlers - left (and the 1 external handler). After the first - SIGQUIT, there are no SIGQUIT handlers left since they all - deregister themselves (which restores the "SIG_DFL" - disposition). On the second SIGINT there are only 3 - handlers left (2 of ours and 1 external). Finally, on the - second SIGQUIT we exit and dump core since that's what - happens with the default disposition for SIGQUIT. */ - -#include "ace/Log_Msg.h" -#include "ace/Reactor.h" - -class Sig_Handler_1 : public ACE_Event_Handler -{ -public: - Sig_Handler_1 (ACE_Reactor &reactor, char *msg) - : msg_ (msg), - count_ (0), - reactor_ (reactor) - { - // Register the signal handlers. - this->quit_sigkey_ = reactor.register_handler (SIGQUIT, this); - this->int_sigkey_ = reactor.register_handler (SIGINT, this); - - if (this->quit_sigkey_ == -1 || this->int_sigkey_ == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "register_handler")); - } - - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *) - { - this->count_++; - ACE_DEBUG ((LM_DEBUG, - "\nsignal %S occurred in Sig_Handler_1 (%s, %d, %d) with count = %d", - signum, this->msg_, this->int_sigkey_, this->quit_sigkey_, this->count_)); - if (this->count_ != 1 && signum == SIGQUIT) - { - if (this->reactor_.remove_handler (SIGQUIT, 0, 0, - this->quit_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGQUIT in Sig_Handler_1 (%s, %d, %d)", - this->msg_, this->int_sigkey_, this->quit_sigkey_)); - } - else if (this->count_ != 2 && signum == SIGINT) - { - if (this->reactor_.remove_handler (SIGINT, 0, 0, - this->int_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGINT in Sig_Handler_1 (%s, %d, %d)", - this->msg_, this->int_sigkey_, this->quit_sigkey_)); - } - return 0; - } - -protected: - char *msg_; - int count_; - int int_sigkey_; - int quit_sigkey_; - ACE_Reactor &reactor_; -}; - -class Sig_Handler_2 : public Sig_Handler_1 -{ -public: - Sig_Handler_2 (ACE_Reactor &reactor, char *msg) - : Sig_Handler_1 (reactor, msg) - { - } - - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *) - { - this->count_++; - ACE_DEBUG ((LM_DEBUG, - "\nsignal %S occurred in Sig_Handler_2 (%s, %d, %d) with count = %d", - signum, this->msg_, this->int_sigkey_, this->quit_sigkey_, this->count_)); - if (this->count_ != 0 && signum == SIGQUIT) - { - if (this->reactor_.remove_handler (SIGQUIT, 0, 0, - this->quit_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGQUIT in Sig_Handler_2 (%s, %d, %d)", - this->msg_, this->int_sigkey_, this->quit_sigkey_)); - } - else - return 0; - } -}; - -static void -external_handler (int signum) -{ - ACE_DEBUG ((LM_DEBUG, "\nsignal %S occurred in external handler!", signum)); -} - -#if !defined (HPUX) -int -main (int argc, char *argv) -{ - // If argc > 1 then allow multiple handlers per-signal, else just - // allow 1 handler per-signal. - ACE_Sig_Handlers multi_handlers; - - ACE_Reactor reactor (argc > 1 ? &multi_handlers: 0); - - if (argc > 1) - { - // Register an "external" signal handler so that the - // ACE_Sig_Handlers code will have something to incorporate! - ACE_SignalHandler eh = ACE_SignalHandler (external_handler); - ACE_Sig_Action sa (eh); - - sa.register_action (SIGINT); - } - - // Create a bevy of handlers. - Sig_Handler_1 h1 (reactor, "howdy"), h2 (reactor, "doody"); - Sig_Handler_2 h3 (reactor, "tutty"), h4 (reactor, "fruity"); - - // Wait for user to type SIGINT and SIGQUIT. - - for (;;) - { - ACE_DEBUG ((LM_DEBUG, "\nwaiting for SIGINT or SIGQUIT\n")); - reactor.handle_events (); - } - return 0; -} -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, "The HP C++ compiler is too lame to support this feature\n"), -1); -} -#endif /* HPUX */ diff --git a/examples/Reactor/Misc/test_signals_1.cpp b/examples/Reactor/Misc/test_signals_1.cpp deleted file mode 100644 index f51fb6c9c4a..00000000000 --- a/examples/Reactor/Misc/test_signals_1.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// $Id$ - -// This simple program illustrates the difference between handling -// signals via the Reactor (which doesn't cause the event loop to -// terminate) and signals that aren't handled via the Reactor (which -// do). - -#include "ace/Service_Config.h" - -ACE_RCSID(Misc, test_signals_1, "$Id$") - -// Number of times to allow signal to execute until we quit. -static size_t count = 10; - -static void -my_signal_function (int sig) -{ - ACE_DEBUG ((LM_DEBUG, - "Executed non-ACE signal handler for signal %S\n", - sig)); -} - -class My_Handler : public ACE_Event_Handler -{ -public: - virtual int handle_signal (int sig, - siginfo_t *, - ucontext_t *) - { - // @@ Note that this code is not portable to all OS platforms - // since it uses print statements within signal handler context. - ACE_DEBUG ((LM_DEBUG, - "Executed ACE signal handler for signal %S, count = %d\n", - sig, - count)); - count--; - - if (count == 0) - ACE_Reactor::end_event_loop (); - - return 0; - } - - virtual int handle_timeout (const ACE_Time_Value &, - const void *arg) - { - ACE_DEBUG ((LM_DEBUG, - "%s\n", - (const char *) arg)); - return 0; - } -}; - -int -main (int argc, char *argv[]) -{ - // First you need a handler for the timeout. - My_Handler my_handler; - - // This is the timeout period in seconds. - ACE_Time_Value period (ACE_DEFAULT_TIMEOUT); - - if (argc > 1) - period.set (ACE_OS::atoi (argv[1])); - - // Set up the periodic interval timer. - if (ACE_Reactor::instance ()->schedule_timer - (&my_handler, - "hello", - period, - period) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, - "%p\n", - "schedule_timer"), - -1); - - // Set up an ACE signal handler. - - if (ACE_Reactor::instance ()->register_handler - (SIGINT, - &my_handler) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, - "%p\n", - "register_handler"), - -1); - - // Set up a non-ACE signal handler. When this goes off, the Reactor - // should return from its <run_event_loop> method. - ACE_Sig_Action sig ((ACE_SignalHandler) my_signal_function, - SIGQUIT); - ACE_UNUSED_ARG (sig); - - ACE_DEBUG ((LM_DEBUG, - "starting event loop that runs until you've typed ^C a total of 10 times or ^\\ once.\n")); - - // This call executes the reactor events until we're finished. - int result = ACE_Reactor::run_event_loop (); - - ACE_DEBUG ((LM_DEBUG, - "result = %d\n", - result)); - - // Make sure to remove my_handler before exiting main() since - // otherwise weird things can happen... - if (ACE_Reactor::instance ()->cancel_timer (&my_handler) == -1) - ACE_ERROR_RETURN ((LM_DEBUG, - "%p\n", - "cancel_timer"), - -1); - return 0; -} diff --git a/examples/Reactor/Misc/test_signals_2.cpp b/examples/Reactor/Misc/test_signals_2.cpp deleted file mode 100644 index 8ac6e402722..00000000000 --- a/examples/Reactor/Misc/test_signals_2.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// $Id$ - -// Test the ability of the Reactor/Signal_Handler to register multiple -// handler per-signal. - -/* This test works as follows: - - 1. To test the "original" semantics of ACE (i.e., only one - ACE_Event_Handler can be registered per signal), you don't - need to do anything special. Existing programs work the - same since giving the Reactor's constructor a 0 value - (which is the default argument, BTW) instructs it to behave - as before. When a 0 is given, the ACE_Reactor's - constructor/open method creates an instance of - ACE_Sig_Handler and assigns this to an internal pointer. - This pointer is then used to dispatch all signal-related - methods within the Reactor. The default ACE_Sig_Handler - only allows *one* ACE_Event_Handler to be registered - per-signal. - - To run this version of the test do the following: - - % ./test-signal - ./test_signals - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 1 - waiting for SIGINT or SIGQUIT - ^\ - signal Quit occurred in Sig_Handler_2 (fruity, 0, 0) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (fruity, 0, 0) - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 3 - waiting for SIGINT or SIGQUIT - ^\Quit (core dumped) - - Note that in this test only one handler (the last one -- - "Sig_Handler_2 (fruity)") is actually registered. BTW, the - core dump is the expected behavior since the default - disposition is restored when there are no more handlers - (see the code below). - - 2. To test the "multiple handlers per-signal semantics", you - need to pass the constructor/open method of the ACE_Reactor - a pointer to a an instance of ACE_Sig_Handlers (note the - plural "s"). ACE_Sig_Handlers is a class that derives from - ACE_Sig_Handler. The difference between these two classes - is that (1) ACE_Sig_Handlers::register_signal allows - multiple ACE_Event_Handlers to be registered per-signal and - (2) it enables SA_RESTART by default. This class also - implements Detlef Becker's algorithm for integrating ACE - signal handling with 3rd party libraries. - - To run this version of the test do the following: - - % ./test_signals 1 - - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in external handler! - signal Interrupt occurred in Sig_Handler_1 (howdy, 3, 1) with count = 1 - shutting down SIGINT in Sig_Handler_1 (howdy, 3, 1) - signal Interrupt occurred in Sig_Handler_1 (doody, 5, 4) with count = 1 - shutting down SIGINT in Sig_Handler_1 (doody, 5, 4) - signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 1 - signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 1 - waiting for SIGINT or SIGQUIT - ^\ - signal Quit occurred in Sig_Handler_1 (howdy, 3, 1) with count = 2 - shutting down SIGQUIT in Sig_Handler_1 (howdy, 3, 1) - signal Quit occurred in Sig_Handler_1 (doody, 5, 4) with count = 2 - shutting down SIGQUIT in Sig_Handler_1 (doody, 5, 4) - signal Quit occurred in Sig_Handler_2 (tutty, 7, 6) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (tutty, 7, 6) - signal Quit occurred in Sig_Handler_2 (fruity, 9, 8) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (fruity, 9, 8) - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in external handler! - signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 3 - signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 3 - waiting for SIGINT or SIGQUIT - ^\Quit (core dumped) - - When this test begins all four handlers are registered and - dispatched when a SIGINT or SIGQUIT occurs. After the - first SIGINT, the handle_signal method of the Sig_Handler_1 - objects unregister themselves. At that point there are 4 - SIGQUIT handlers left, but only 2 of our SIGINT handlers - left (and the 1 external handler). After the first - SIGQUIT, there are no SIGQUIT handlers left since they all - deregister themselves (which restores the "SIG_DFL" - disposition). On the second SIGINT there are only 3 - handlers left (2 of ours and 1 external). Finally, on the - second SIGQUIT we exit and dump core since that's what - happens with the default disposition for SIGQUIT. */ - - -#include "ace/Reactor.h" -#include "ace/WFMO_Reactor.h" -#include "ace/Select_Reactor.h" - -ACE_RCSID(Misc, test_signals_2, "$Id$") - -class Sig_Handler_1 : public ACE_Event_Handler -{ -public: - Sig_Handler_1 (ACE_Reactor &reactor, const char *msg) - : msg_ (msg), - count_ (0), - reactor_ (reactor) - { - // Register the signal handlers. - this->quit_sigkey_ = - reactor.register_handler (SIGQUIT, this); - this->int_sigkey_ = - reactor.register_handler (SIGINT, this); - - if (this->quit_sigkey_ == -1 || this->int_sigkey_ == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "register_handler")); - } - - // @@ Note that this code is not portable to all OS platforms since - // it does print statements within the signal handler. - virtual int handle_signal (int signum, - siginfo_t *, - ucontext_t *) - { - this->count_++; - ACE_DEBUG ((LM_DEBUG, - "\nsignal %S occurred in Sig_Handler_1 (%s, %d, %d) with count = %d", - signum, - this->msg_, - this->int_sigkey_, - this->quit_sigkey_, - this->count_)); - - if (this->count_ != 1 && signum == SIGQUIT) - { - if (this->reactor_.remove_handler (SIGQUIT, - 0, - 0, - this->quit_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, - "\n%p", - "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, - "\nshutting down SIGQUIT in Sig_Handler_1 (%s, %d, %d)", - this->msg_, - this->int_sigkey_, - this->quit_sigkey_)); - } - else if (this->count_ != 2 && signum == SIGINT) - { - if (this->reactor_.remove_handler (SIGINT, - 0, - 0, - this->int_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, - "\n%p", - "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, - "\nshutting down SIGINT in Sig_Handler_1 (%s, %d, %d)", - this->msg_, - this->int_sigkey_, - this->quit_sigkey_)); - } - return 0; - } - -protected: - const char *msg_; - int count_; - int int_sigkey_; - int quit_sigkey_; - ACE_Reactor &reactor_; -}; - -class Sig_Handler_2 : public Sig_Handler_1 -{ -public: - Sig_Handler_2 (ACE_Reactor &reactor, const char *msg) - : Sig_Handler_1 (reactor, msg) - { - } - - virtual int handle_signal (int signum, - siginfo_t *, - ucontext_t *) - { - this->count_++; - ACE_DEBUG ((LM_DEBUG, - "\nsignal %S occurred in Sig_Handler_2 (%s, %d, %d) with count = %d", - signum, - this->msg_, - this->int_sigkey_, - this->quit_sigkey_, - this->count_)); - if (this->count_ != 0 && signum == SIGQUIT) - { - if (this->reactor_.remove_handler (SIGQUIT, 0, 0, - this->quit_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, - "\n%p", - "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, - "\nshutting down SIGQUIT in Sig_Handler_2 (%s, %d, %d)", - this->msg_, - this->int_sigkey_, - this->quit_sigkey_)); - } - return 0; - } -}; - -static void -external_handler (int signum) -{ - ACE_DEBUG ((LM_DEBUG, - "\nsignal %S occurred in external handler!", - signum)); -} - -#if !defined (HPUX) -int -main (int argc, char *[]) -{ - // If argc > 1 then allow multiple handlers per-signal, else just - // allow 1 handler per-signal. - ACE_Sig_Handlers multi_handlers; - -#if defined (ACE_WIN32) - ACE_WFMO_Reactor reactor_impl (argc > 1 - ? &multi_handlers - : (ACE_Sig_Handler *) 0); -#else - ACE_Select_Reactor reactor_impl (argc > 1 - ? &multi_handlers - : (ACE_Sig_Handler *) 0); -#endif /* ACE_WIN32 */ - ACE_Reactor reactor (&reactor_impl); - - if (argc > 1) - { - // Register an "external" signal handler so that the - // ACE_Sig_Handlers code will have something to incorporate! - - ACE_SignalHandler eh = (ACE_SignalHandler) external_handler; - ACE_Sig_Action sa (eh); - - sa.register_action (SIGINT); - } - - // Create a bevy of handlers. - Sig_Handler_1 h1 (reactor, "howdy"); - Sig_Handler_1 h2 (reactor, "doody"); - Sig_Handler_2 h3 (reactor, "tutty"); - Sig_Handler_2 h4 (reactor, "fruity"); - - // Wait for user to type SIGINT and SIGQUIT. - - for (;;) - { - ACE_DEBUG ((LM_DEBUG, - "\nwaiting for SIGINT or SIGQUIT\n")); - - if (reactor.handle_events () == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "handle_events")); - } - - ACE_NOTREACHED (return 0); -} -#else -int -main (int, char *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "The HP C++ compiler is too lame to support this feature\n"), - -1); -} -#endif /* HPUX */ diff --git a/examples/Reactor/Misc/test_time_value.cpp b/examples/Reactor/Misc/test_time_value.cpp deleted file mode 100644 index 48bf0729f34..00000000000 --- a/examples/Reactor/Misc/test_time_value.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -#include "ace/OS.h" -#include "ace/streams.h" - -ACE_RCSID(Misc, test_time_value, "$Id$") - -inline int my_abs (int d) { return d > 0 ? d : -d; } - -ostream & -operator<< (ostream &stream, const ACE_Time_Value &tv) -{ - if (tv.usec () < 0 || tv.sec () < 0) - stream << "-"; - - stream << my_abs (int (tv.sec ())) << "." -// << setw (6) << setfill ('0') - << my_abs (int (tv.usec ())); - return stream; -} - -int -main (int, char *[]) -{ - ACE_Time_Value tv1; - ACE_Time_Value tv2 (2); - ACE_Time_Value tv3 (100); - ACE_Time_Value tv4 (1, 1000000); - ACE_Time_Value tv5 (2); - ACE_Time_Value tv6 (1, -1000000); - - ACE_ASSERT (tv1 == ACE_Time_Value (0)); - ACE_ASSERT (tv2 < tv3); - ACE_ASSERT (tv2 <= tv2); - ACE_ASSERT (tv2 >= tv4); - ACE_ASSERT (tv5 >= tv6); - ACE_ASSERT (tv2 == ACE_Time_Value (1, 1000000)); - ACE_ASSERT (tv5 == tv4); - ACE_ASSERT (tv2 == tv4); - ACE_ASSERT (tv1 != tv2); - ACE_ASSERT (tv6 == tv1); - - cout << "0,0 :\t\t" << ACE_Time_Value (0,0) << endl; - cout << "-0,0 :\t\t" << ACE_Time_Value (-0,0) << endl; - cout << "0,-0 :\t\t" << ACE_Time_Value (0,-0) << endl; - cout << "-0,-0 :\t\t" << ACE_Time_Value (-0,-0) << endl; - cout << endl; - - cout << "0,1 :\t\t" << ACE_Time_Value (0,1) << endl; - cout << "1,0 :\t\t" << ACE_Time_Value (1,0) << endl; - cout << "-1,0 :\t\t" << ACE_Time_Value (-1,0) << endl; - cout << "-1,-0 :\t\t" << ACE_Time_Value (-1,-0) << endl; - cout << endl; - - cout << "1,1 :\t\t" << ACE_Time_Value (1,1) << endl; - cout << "-1,1 :\t\t" << ACE_Time_Value (-1,1) << endl; - cout << "1,-1 :\t\t" << ACE_Time_Value (1,-1) << endl; - cout << "-1,-1 :\t\t" << ACE_Time_Value (-1,-1) << endl; - cout << endl; - - cout << "1,-1111111 :\t" << ACE_Time_Value (1,-1111111) << endl; - cout << "1,-100000 :\t" << ACE_Time_Value (1,-100000) << endl; - cout << "1,-1000000 :\t" << ACE_Time_Value (1,-1000000) << endl; - cout << "-1,1000000 :\t" << ACE_Time_Value (-1,1000000) << endl; - cout << "5,-1000000 :\t" << ACE_Time_Value (5,-1000000) << endl; - cout << "5,-1500000 :\t" << ACE_Time_Value (5,-1500000) << endl; - cout << "2,-2500000 :\t" << ACE_Time_Value (2,-2500000) << endl; - cout << "2,-4500000 :\t" << ACE_Time_Value (2,-4500000) << endl; - - return 0; -} - diff --git a/examples/Reactor/Misc/test_timer_queue.cpp b/examples/Reactor/Misc/test_timer_queue.cpp deleted file mode 100644 index 0eda39b495c..00000000000 --- a/examples/Reactor/Misc/test_timer_queue.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// $Id$ - -#include "ace/Timer_Heap.h" -#include "ace/Timer_List.h" -#include "ace/Timer_Queue.h" - -ACE_RCSID(Misc, test_timer_queue, "$Id$") - -class Example_Handler : public ACE_Event_Handler -{ -public: - Example_Handler (void) - : count_ (0) - {} - - virtual int handle_timeout (const ACE_Time_Value &, const void *arg) - { - // Cast the arg to a long, first, because a pointer is the same - // size as a long on all current ACE platforms. - int times = (int) (long) arg; - - ACE_DEBUG ((LM_DEBUG, - "yow, the time has come and gone %d times %d, Horatio!\n", - this->count_++, - times)); - return 0; - } - -private: - int count_; -}; - -static void -test_functionality (ACE_Timer_Queue *tq) -{ - Example_Handler eh; - - ACE_ASSERT (tq->is_empty ()); - ACE_ASSERT (ACE_Time_Value::zero == ACE_Time_Value (0)); - int timer_id; - - timer_id = tq->schedule (&eh, (const void *) 1, ACE_OS::gettimeofday ()); - - // Use timer_id outside of an assert, so that we don't get compile - // warnings with ACE_NDEBUG about it being unused. - if (timer_id == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "schedule () failed")); - ACE_ASSERT (timer_id != -1); - - ACE_ASSERT (tq->schedule (&eh, (const void *) 42, - ACE_OS::gettimeofday ()) != -1); - ACE_ASSERT (tq->schedule (&eh, (const void *) 42, - ACE_OS::gettimeofday ()) != -1); - ACE_ASSERT (tq->cancel (timer_id) == 1); - ACE_ASSERT (!tq->is_empty ()); - - ACE_ASSERT (tq->expire () == 2); - - ACE_ASSERT (tq->schedule (&eh, (const void *) 4, ACE_OS::gettimeofday - ()) != -1); - ACE_ASSERT (tq->schedule (&eh, (const void *) 5, ACE_OS::gettimeofday - ()) != -1); - ACE_ASSERT (tq->cancel (&eh) == 2); - ACE_ASSERT (tq->is_empty ()); - ACE_ASSERT (tq->expire () == 0); -} - -struct Timer_Queues -{ - ACE_Timer_Queue *queue_; - // Pointer to the subclass of <ACE_Timer_Queue> that we're testing. - - const char *name_; - // Name of the Queue that we're testing. -}; - -static Timer_Queues timer_queues[] = -{ - { new ACE_Timer_List, "ACE_Timer_List" }, - { new ACE_Timer_Heap, "ACE_Timer_Heap" }, - { 0, 0 }, -}; - -int -main (int, char *[]) -{ - for (int i = 0; timer_queues[i].name_ != 0; i++) - { - test_functionality (timer_queues[i].queue_); - delete timer_queues[i].queue_; - } - - return 0; -} diff --git a/examples/Reactor/Multicast/Log_Wrapper.cpp b/examples/Reactor/Multicast/Log_Wrapper.cpp deleted file mode 100644 index 054dfc298fb..00000000000 --- a/examples/Reactor/Multicast/Log_Wrapper.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -// client.C - -#include "Log_Wrapper.h" - -ACE_RCSID(Multicast, Log_Wrapper, "$Id$") - -Log_Wrapper::Log_Wrapper (void) -{ - sequence_number_ = 0; - this->log_msg_.app_id = ACE_OS::getpid (); -} - -Log_Wrapper::~Log_Wrapper (void) -{ -} - -// Set the log_msg_ host address. - -int -Log_Wrapper::open (const int port, const char *mcast_addr) -{ - struct hostent *host_info; - struct utsname host_data; - - if (ACE_OS::uname (&host_data) < 0) - return -1; - - if ((host_info = ACE_OS::gethostbyname (host_data.nodename)) == NULL) - return -1; - else - ACE_OS::memcpy ((char *) &this->log_msg_.host, - (char *) host_info->h_addr, - host_info->h_length); - - // This starts out initialized to all zeros! - server_ = ACE_INET_Addr(port, mcast_addr); - - if (logger_.subscribe (server_) == -1) - perror("can't subscribe to multicast group"), exit(1); - - // success. - return 0; -} - -// Send the message to a logger object. -// This wrapper fills in all the log_record info for you. -// uses iovector stuff to make contiguous header and message. - -int -Log_Wrapper::log_message (ACE_Log_Priority type, char *message) -{ - sequence_number_++; - - this->log_msg_.type = type; - this->log_msg_.time = time (0); - this->log_msg_.msg_length = strlen(message)+1; - this->log_msg_.sequence_number = htonl(sequence_number_); - - iovec iovp[2]; - iovp[0].iov_base = ACE_reinterpret_cast (char*, &log_msg_); - iovp[0].iov_len = sizeof (log_msg_); - iovp[1].iov_base = message; - iovp[1].iov_len = log_msg_.msg_length; - - logger_.send (iovp, 2); - - // success. - return 0; -} - diff --git a/examples/Reactor/Multicast/Log_Wrapper.h b/examples/Reactor/Multicast/Log_Wrapper.h deleted file mode 100644 index 75da02839c5..00000000000 --- a/examples/Reactor/Multicast/Log_Wrapper.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// log_wrapper.h - -#include "ace/Profile_Timer.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/INET_Addr.h" -#include "ace/SOCK_Dgram_Mcast.h" - -#ifndef _LOG_WRAPPER_H -#define _LOG_WRAPPER_H - -class Log_Wrapper - // = TITLE - // Provide a wrapper around sending log messages via IP - // multicast. -{ -public: - Log_Wrapper (void); - ~Log_Wrapper (void); - - // = Types of logging messages. - enum ACE_Log_Priority - { - LOG_MESSAGE, - LOG_DEBUG, - LOG_WARNING, - LOG_ERROR, - LOG_EMERG - }; - - int open (const int port, const char* mcast_addr); - // get an object reference from an orbixd - - int log_message (ACE_Log_Priority type, char *message); - // send a string to the logger - - // = Format of the logging record. - struct ACE_Log_Record - { - u_long sequence_number; - ACE_Log_Priority type; - long host; - long time; - long app_id; - long msg_length; - }; - -private: - ACE_INET_Addr server_; - // Server address where records are logged. - - u_long sequence_number_; - // Keep track of the sequence. - - ACE_Log_Record log_msg_; - // One record used for many log messages. - - ACE_SOCK_Dgram_Mcast logger_; - // A logger object. -}; - -#endif /* _LOG_WRAPPER_H */ diff --git a/examples/Reactor/Multicast/Makefile b/examples/Reactor/Multicast/Makefile deleted file mode 100644 index b5190d3e2a3..00000000000 --- a/examples/Reactor/Multicast/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -# Makefile for the Reactor multicast tests -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = client server - -FILES = Log_Wrapper - -SRC = $(addsuffix .cpp,$(FILES)) -OBJ = $(addsuffix .o,$(FILES)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# ACE stuff -#---------------------------------------------------------------------------- - -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.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -.obj/Log_Wrapper.o .obj/Log_Wrapper.so .shobj/Log_Wrapper.o .shobj/Log_Wrapper.so: Log_Wrapper.cpp Log_Wrapper.h \ - $(ACE_ROOT)/ace/Profile_Timer.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - $(ACE_ROOT)/ace/Profile_Timer.i \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \ - $(ACE_ROOT)/ace/SOCK_Dgram.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/QoS_Session.h \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(ACE_ROOT)/ace/Memory_Pool.h \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_Dgram.i \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Reactor/Multicast/Multicast.dsw b/examples/Reactor/Multicast/Multicast.dsw deleted file mode 100644 index d17cf7c9604..00000000000 --- a/examples/Reactor/Multicast/Multicast.dsw +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "client"=.\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "server"=.\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/Reactor/Multicast/README b/examples/Reactor/Multicast/README deleted file mode 100644 index 85f64cc8120..00000000000 --- a/examples/Reactor/Multicast/README +++ /dev/null @@ -1,15 +0,0 @@ -The following test illustrates the SOCK Mcast multicast wrappers in -conjunction with the Reactor. This test was written by Tim Harrison -(harrison@cs.wustl.edu). - -To run the server type: - -% server & - -It will wait for the first message sent to it and then read for 5 seconds. - -To run the client type any of these: - -% client -m max_message_size -i iterations -% client < <filename> -% client diff --git a/examples/Reactor/Multicast/client.cpp b/examples/Reactor/Multicast/client.cpp deleted file mode 100644 index d194ce6bf79..00000000000 --- a/examples/Reactor/Multicast/client.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// $Id$ - -// This program reads in messages from stdin and sends them to a -// Log_Wrapper. - -#include "ace/Get_Opt.h" -#include "Log_Wrapper.h" - -ACE_RCSID(Multicast, client, "$Id$") - -// Multi-cast address. -static const char *MCAST_ADDR = ACE_DEFAULT_MULTICAST_ADDR; - -// UDP port. -static const int UDP_PORT = ACE_DEFAULT_MULTICAST_PORT; - -// Maximum message size. -static int max_message_size = BUFSIZ; - -// Number of times to send message of max_message_size. -static int iterations = 0; - -static void -parse_args (int argc, char *argv[]) -{ - ACE_LOG_MSG->open (argv[0]); - - // Start at argv[1] - ACE_Get_Opt getopt (argc, argv, "m:ui:", 1); - - for (int c; (c = getopt ()) != -1; ) - switch (c) - { - case 'm': - max_message_size = ACE_OS::atoi (getopt.optarg) * BUFSIZ; - break; - case 'i': - iterations = ACE_OS::atoi (getopt.optarg); - break; - case 'u': - // usage fallthrough - default: - ACE_ERROR ((LM_ERROR, - "%n: -m max_message_size (in k) -i iterations\n%a", - 1)); - /* NOTREACHED */ - } -} - -int -main (int argc, char **argv) -{ - int user_prompt; - - parse_args (argc,argv); - - ACE_DEBUG ((LM_DEBUG, "max buffer size = %d\n", max_message_size)); - - // Instantiate a log wrapper for logging - Log_Wrapper log; - - // Make a connection to a logger. - if (log.open (UDP_PORT, MCAST_ADDR) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n" "open"), -1); - - char *buf; - ACE_NEW_RETURN (buf, char[max_message_size], -1); - - // If -i has been specified, send max_message_size messages - // iterations number of times. - if (iterations) - { - ACE_OS::memset (buf, 1, max_message_size); - - while (iterations--) - if (log.log_message (Log_Wrapper::LOG_DEBUG, buf) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n" "log"), -1); - } - - // otherwise, a file has been redirected, or give prompts - else - { - // If a file has been redirected, don't activate user prompts. - if (ACE_OS::isatty (0)) - user_prompt = 1; - else - user_prompt = 0; - - // Continually read messages from stdin and log them. - - for (int count = 1;;) - { - if (user_prompt) - ACE_DEBUG ((LM_DEBUG, "\nEnter message ('Q':quit):\n")); - - ssize_t nbytes = ACE_OS::read (ACE_STDIN, buf, max_message_size); - - if (nbytes <= 0) - break; // End of file or error. - buf[nbytes - 1] = '\0'; - - // Quitting? - if (user_prompt) - { - if (buf[0] == 'Q' || buf[0] == 'q') - break; - } - else // Keep from overrunning the receiver. - ACE_OS::sleep (1); - - // Send the message to the logger. - if (log.log_message (Log_Wrapper::LOG_DEBUG, buf) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n" "log_message"), -1); - ACE_DEBUG ((LM_DEBUG, "finished sending message %d\n", count++)); - } - } - - ACE_DEBUG ((LM_DEBUG, "Client done.\n")); - return 0; -} diff --git a/examples/Reactor/Multicast/client.dsp b/examples/Reactor/Multicast/client.dsp deleted file mode 100644 index 6d5cab32270..00000000000 --- a/examples/Reactor/Multicast/client.dsp +++ /dev/null @@ -1,93 +0,0 @@ -# Microsoft Developer Studio Project File - Name="client" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=client - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "client.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "client.mak" CFG="client - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "client - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "client - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "client - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /machine:I386
-# ADD LINK32 ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace"
-
-!ELSEIF "$(CFG)" == "client - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "client - Win32 Release"
-# Name "client - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\client.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Log_Wrapper.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Multicast/server.cpp b/examples/Reactor/Multicast/server.cpp deleted file mode 100644 index a3630d71a1e..00000000000 --- a/examples/Reactor/Multicast/server.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// $Id$ - -// server.C (written by Tim Harrison) - -// Listens to multicast address for client log messages. Prints -// Mbits/sec received from client. - -#include "ace/SOCK_Dgram.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_Dgram_Mcast.h" -#include "ace/Reactor.h" -#include "Log_Wrapper.h" - -ACE_RCSID(Multicast, server, "$Id$") - -#if defined (ACE_HAS_IP_MULTICAST) -class Server_Events : public ACE_Event_Handler -{ -public: - Server_Events (u_short port, - const char *mcast_addr, - long time_interval = 0); - ~Server_Events (void); - - virtual int handle_input (ACE_HANDLE fd); - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg); - - virtual ACE_HANDLE get_handle (void) const; - - ACE_Time_Value *wait_time (void); - -private: - char *message_; - Log_Wrapper::ACE_Log_Record *log_record_; - char buf_[4 * BUFSIZ]; - char hostname_[MAXHOSTNAMELEN]; - - int initialized_; - int count_; - int interval_; - // time interval to log messages - - ACE_Time_Value *how_long_; - ACE_Reactor *reactor_; - ACE_SOCK_Dgram_Mcast mcast_dgram_; - ACE_INET_Addr remote_addr_; - ACE_INET_Addr mcast_addr_; - - // = statistics on messages received - double total_bytes_received_; - int total_messages_received_; - int last_sequence_number_; -}; - -static const char MCAST_ADDR[] = ACE_DEFAULT_MULTICAST_ADDR; -static const int UDP_PORT = ACE_DEFAULT_MULTICAST_PORT; -static const int DURATION = 5; - -ACE_HANDLE -Server_Events::get_handle (void) const -{ - return this->mcast_dgram_.get_handle (); -} - -ACE_Time_Value * -Server_Events::wait_time (void) -{ - return this->how_long_; -} - -Server_Events::Server_Events (u_short port, - const char *mcast_addr, - long time_interval) - : initialized_ (0), - count_ (1), - interval_ (time_interval), - mcast_addr_ (port, mcast_addr), - total_bytes_received_ (0) -{ - // Use ACE_SOCK_Dgram_Mcast factory to subscribe to multicast group. - - if (ACE_OS::hostname (this->hostname_, MAXHOSTNAMELEN) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "hostname")); - - else if (this->mcast_dgram_.subscribe (this->mcast_addr_) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "subscribe")); - - else - { - // Point to NULL so that we block in the beginning. - this->how_long_ = 0; - - this->log_record_ = (Log_Wrapper::ACE_Log_Record *) &buf_; - this->message_ = &buf_[sizeof (Log_Wrapper::ACE_Log_Record)]; - } -} - -// A destructor that emacs refuses to color blue ;-) - -Server_Events::~Server_Events (void) -{ - this->mcast_dgram_.unsubscribe (); - - ACE_DEBUG ((LM_DEBUG, "total bytes received = %d after %d second\n", - this->total_bytes_received_, this->interval_)); - - ACE_DEBUG ((LM_DEBUG, "Mbits/sec = %.2f\n", - (float) (total_bytes_received_ * 8 / (float) (1024*1024*interval_)))); - - ACE_DEBUG ((LM_DEBUG, - "last sequence number = %d\ntotal messages received = %d\ndiff = %d\n", - this->last_sequence_number_, - this->total_messages_received_, - this->last_sequence_number_ - total_messages_received_)); -} - -int -Server_Events::handle_timeout (const ACE_Time_Value &, - const void *arg) -{ - ACE_DEBUG ((LM_DEBUG, "\t%d timeout%s occurred for %s.\n", - this->count_, - this->count_ == 1 ? "" : "s", - (char *) arg)); - - // Don't let the timeouts continue if there's no activity since - // otherwise we use up a lot of CPU time unnecessarily. - if (this->count_ == 5) - { - reactor ()->cancel_timer (this); - this->initialized_ = 0; - - ACE_DEBUG ((LM_DEBUG, - "\tcancelled timeout for %s to avoid busy waiting.\n", - (char *) arg)); - } - - this->count_++; - return 0; -} - -int -Server_Events::handle_input (ACE_HANDLE) -{ - // Receive message from multicast group. - iovec iovp[2]; - iovp[0].iov_base = buf_; - iovp[0].iov_len = sizeof (log_record_); - iovp[1].iov_base = &buf_[sizeof (log_record_)]; - iovp[1].iov_len = 4 * BUFSIZ - sizeof (log_record_); - - ssize_t retcode = - this->mcast_dgram_.recv (iovp, 2, this->remote_addr_); - - if (retcode != -1) - { - total_messages_received_++; - total_bytes_received_ += retcode; - last_sequence_number_ = ntohl (log_record_->sequence_number); - - ACE_DEBUG ((LM_DEBUG, "sequence number = %d\n", - last_sequence_number_)); - ACE_DEBUG ((LM_DEBUG, "message = '%s'\n", - this->message_)); - - if (this->initialized_ == 0) - { - // Restart the timer since we've received events again. - if (reactor()->schedule_timer (this, - (void *) this->hostname_, - ACE_Time_Value::zero, - ACE_Time_Value (DURATION)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - this->initialized_ = 1; - } - - this->count_ = 1; - return 0; - } - else - return -1; -} - -int -main (int, char *[]) -{ - // Instantiate a server which will receive messages for DURATION - // seconds. - Server_Events server_events (UDP_PORT, MCAST_ADDR, DURATION); - - // Instance of the ACE_Reactor. - ACE_Reactor reactor; - - if (reactor.register_handler (&server_events, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1)); - - ACE_DEBUG ((LM_DEBUG, "starting up server\n")); - - for (;;) - reactor.handle_events (server_events.wait_time ()); - - ACE_NOTREACHED (return 0;) -} -#else -int -main (int, char *argv[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "error: %s must be run on a platform that support IP multicast\n", - argv[0]), -1); -} -#endif /* ACE_HAS_IP_MULTICAST */ diff --git a/examples/Reactor/Multicast/server.dsp b/examples/Reactor/Multicast/server.dsp deleted file mode 100644 index 27b91febcd1..00000000000 --- a/examples/Reactor/Multicast/server.dsp +++ /dev/null @@ -1,93 +0,0 @@ -# Microsoft Developer Studio Project File - Name="server" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=server - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "server.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "server.mak" CFG="server - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "server - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "server - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "server - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /machine:I386
-# ADD LINK32 ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace"
-
-!ELSEIF "$(CFG)" == "server - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "server - Win32 Release"
-# Name "server - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\Log_Wrapper.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\server.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Ntalker/Makefile b/examples/Reactor/Ntalker/Makefile deleted file mode 100644 index 9828b4b157d..00000000000 --- a/examples/Reactor/Ntalker/Makefile +++ /dev/null @@ -1,136 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile for ntalker demo of SOCK_Dgram_Mcast -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = ntalker - -SRC = $(addsuffix .cpp,$(BIN)) - -LDLIBS = -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# ACE stuff -#---------------------------------------------------------------------------- - -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.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -.obj/ntalker.o .obj/ntalker.so .shobj/ntalker.o .shobj/ntalker.so: ntalker.cpp \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \ - $(ACE_ROOT)/ace/SOCK_Dgram.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/QoS_Session.h \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(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/Synch_T.cpp \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(ACE_ROOT)/ace/Memory_Pool.h \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_Dgram.i \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.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/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Get_Opt.h \ - $(ACE_ROOT)/ace/Get_Opt.i \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(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/Managed_Object.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - $(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/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Service_Config.i \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Reactor/Ntalker/README b/examples/Reactor/Ntalker/README deleted file mode 100644 index 191cef9256f..00000000000 --- a/examples/Reactor/Ntalker/README +++ /dev/null @@ -1,17 +0,0 @@ -This test program illustrates how the ACE datagram multicast feature -works. To run the test simply do the following on multiple machines: - -# Machine 1 -% ./ntalker - -# Machine 2 -% ./ntalker - -# Machine 3 -% ./ntalker - -Then, on one (or all) of the machines, type input into the keyboard. -This input will be multicast to all the machines using IP multicast -via the ACE_SOCK_Dgram_Mcast wrapper. - -When you want to shut down the sender, just type ^D. diff --git a/examples/Reactor/Ntalker/ntalker.cpp b/examples/Reactor/Ntalker/ntalker.cpp deleted file mode 100644 index 26b2566c467..00000000000 --- a/examples/Reactor/Ntalker/ntalker.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// $Id$ - -// Listens to multicast address. After first message received, will -// listen for 5 more seconds. Prints Mbits/sec received from client. - -#include "ace/INET_Addr.h" -#include "ace/SOCK_Dgram_Mcast.h" -#include "ace/Reactor.h" -#include "ace/Get_Opt.h" -#include "ace/Thread_Manager.h" -#include "ace/Service_Config.h" -#include "ace/streams.h" - -ACE_RCSID(Ntalker, ntalker, "$Id$") - -#if defined (ACE_HAS_IP_MULTICAST) -// Network interface to subscribe to. This is hardware specific. use -// netstat(1M) to find whether your interface is le0 or ie0 - -static const char *INTERFACE = 0; -static const char *MCAST_ADDR = ACE_DEFAULT_MULTICAST_ADDR; -static const u_short UDP_PORT = ACE_DEFAULT_MULTICAST_PORT; - -class Handler : public ACE_Event_Handler -{ - // = TITLE - // Handle both multicast and stdin events. -public: - // = Initialization and termination methods. - Handler (u_short udp_port, - const char *ip_addr, - const char *interface, - ACE_Reactor &); - // Constructor. - - ~Handler (void); - // Destructor. - - // Event demuxer hooks. - virtual int handle_input (ACE_HANDLE); - virtual int handle_close (ACE_HANDLE, - ACE_Reactor_Mask); - virtual ACE_HANDLE get_handle (void) const; - -private: - ACE_SOCK_Dgram_Mcast mcast_; - // Multicast wrapper. -}; - -ACE_HANDLE -Handler::get_handle (void) const -{ - return this->mcast_.get_handle (); -} - -int -Handler::handle_input (ACE_HANDLE h) -{ - char buf[BUFSIZ]; - - if (h == ACE_STDIN) - { - ssize_t result = ACE_OS::read (h, buf, BUFSIZ); - - if (result > 0) - { - if (this->mcast_.send (buf, result) != result) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "send error"), - -1); - return 0; - } - else if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "can't read from STDIN"), - -1); - else // result == 0 - { - ACE_Reactor::end_event_loop (); - return -1; - } - } - else - { - ACE_INET_Addr remote_addr; - - // Receive message from multicast group. - ssize_t result = this->mcast_.recv (buf, - sizeof buf, - remote_addr); - - if (result != -1) - { - ACE_DEBUG ((LM_DEBUG, - "received datagram from host %s on port %d bytes = %d\n", - remote_addr.get_host_name (), - remote_addr.get_port_number (), - result)); - ACE_OS::write (ACE_STDERR, buf, result); - ACE_DEBUG ((LM_DEBUG, - "\n")); - return 0; - } - - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "something amiss"), - -1); - } -} - -int -Handler::handle_close (ACE_HANDLE h, ACE_Reactor_Mask) -{ - if (h == ACE_STDIN) - { - ACE_DEBUG ((LM_DEBUG, - "STDIN_Events handle removed from reactor.\n")); - if (ACE_Reactor::instance ()->remove_handler - (this, ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "remove_handler"), - -1); - } - else - ACE_DEBUG ((LM_DEBUG, - "Mcast_Events handle removed from reactor.\n")); - return 0; -} - -Handler::~Handler (void) -{ - if (this->mcast_.unsubscribe () == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "unsubscribe fails")); -} - -Handler::Handler (u_short udp_port, - const char *ip_addr, - const char *interface, - ACE_Reactor &reactor) -{ - // Create multicast address to listen on. - - ACE_INET_Addr sockmc_addr (udp_port, ip_addr); - - // subscribe to multicast group. - - if (this->mcast_.subscribe (sockmc_addr, 1, interface) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "can't subscribe to multicast group")); - - // Disable loopbacks. - // if (this->mcast_.set_option (IP_MULTICAST_LOOP, 0) == -1 ) - // ACE_OS::perror (" can't disable loopbacks " ), ACE_OS::exit (1); - - // Register callbacks with the ACE_Reactor. - else if (reactor.register_handler (this->mcast_.get_handle (), - this, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "can't register with Reactor\n")); - // Register the STDIN handler. - else if (ACE_Event_Handler::register_stdin_handler (this, - ACE_Reactor::instance (), - ACE_Thread_Manager::instance ()) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "register_stdin_handler")); -} - -static void -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, "i:u"); - - int c; - - while ((c = get_opt ()) != -1) - switch (c) - { - case 'i': - INTERFACE = get_opt.optarg; - break; - case 'u': - // Usage fallthrough. - default: - ACE_DEBUG ((LM_DEBUG, - "%s -i interface\n", - argv[0])); - ACE_OS::exit (1); - } -} - -int -main (int argc, char *argv[]) -{ - parse_args (argc, argv); - - Handler handler (UDP_PORT, - MCAST_ADDR, - INTERFACE, - *ACE_Reactor::instance ()); - - // Run the event loop. - ACE_Reactor::run_event_loop (); - - ACE_DEBUG ((LM_DEBUG, - "talker Done.\n")); - return 0; -} -#else -int -main (int, char *argv[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "error: %s must be run on a platform that support IP multicast\n", - argv[0]), - 0); -} -#endif /* ACE_HAS_IP_MULTICAST */ diff --git a/examples/Reactor/Ntalker/ntalker.dsp b/examples/Reactor/Ntalker/ntalker.dsp deleted file mode 100644 index 556783c5d0c..00000000000 --- a/examples/Reactor/Ntalker/ntalker.dsp +++ /dev/null @@ -1,65 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ntalker" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=ntalker - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ntalker.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ntalker.mak" CFG="ntalker - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ntalker - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir ".\debug"
-# PROP Ignore_Export_Lib 0
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "MULTI_THREADED" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "ntalker - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\ntalker.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Ntalker/ntalker.dsw b/examples/Reactor/Ntalker/ntalker.dsw deleted file mode 100644 index 056bd041b9b..00000000000 --- a/examples/Reactor/Ntalker/ntalker.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "ntalker"=.\ntalker.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/Reactor/Proactor/Aio_Platform_Test_C.cpp b/examples/Reactor/Proactor/Aio_Platform_Test_C.cpp deleted file mode 100644 index be720fdef40..00000000000 --- a/examples/Reactor/Proactor/Aio_Platform_Test_C.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// $Id$ -// ============================================================================ -// -// = FILENAME -// aio_platform_test_c.cpp -// -// = DESCRITPTION -// Testing the platform for POSIX Asynchronous I/O. This is the C -// version of the $ACE_ROOT/tests/Aio_Platform_Test.cpp. Useful -// to send bug reports. -// -// = AUTHOR -// Programming for the Real World. Bill O. GallMeister. -// Modified by Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ===================================================================== - - -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <signal.h> -#include <string.h> -#include <errno.h> -#include <stdio.h> - -#include <limits.h> - -#include <aio.h> - -int do_sysconf (void); -int have_asynchio (void); - -static int file_handle = -1; -char mb1 [BUFSIZ + 1]; -char mb2 [BUFSIZ + 1]; -aiocb aiocb1, aiocb2; -sigset_t completion_signal; - -// For testing the <aio> stuff. -int test_aio_calls (void); -int issue_aio_calls (void); -int query_aio_completions (void); -int setup_signal_delivery (void); -int do_sysconf (void); -int have_asynchio (void); - -int -do_sysconf (void) -{ - // Call sysconf to find out runtime values. - errno = 0; -#if defined (_SC_LISTIO_AIO_MAX) - printf ("Runtime value of LISTIO_AIO_MAX is %d, errno = %d\n", - sysconf(_SC_LISTIO_AIO_MAX), - errno); -#else - printf ("Runtime value of AIO_LISTIO_MAX is %d, errno = %d\n", - sysconf(_SC_AIO_LISTIO_MAX), - errno); -#endif - - errno = 0; - printf ("Runtime value of AIO_MAX is %d, errno = %d\n", - sysconf (_SC_AIO_MAX), - errno); - - errno = 0; - printf ("Runtime value of _POSIX_ASYNCHRONOUS_IO is %d, errno = %d\n", - sysconf (_SC_ASYNCHRONOUS_IO), - errno); - - errno = 0; - printf ("Runtime value of _POSIX_REALTIME_SIGNALS is %d, errno = %d\n", - sysconf (_SC_REALTIME_SIGNALS), - errno); - - errno = 0; - printf ("Runtime value of RTSIG_MAX %d, Errno = %d\n", - sysconf (_SC_RTSIG_MAX), - errno); - - errno = 0; - printf ("Runtime value of SIGQUEUE_MAX %d, Errno = %d\n", - sysconf (_SC_SIGQUEUE_MAX), - errno); - return 0; -} - -int -have_asynchio (void) -{ -#if defined (_POSIX_ASYNCHRONOUS_IO) - // POSIX Asynch IO is present in this system. -#if defined (_POSIX_ASYNC_IO) - // If this is defined and it is not -1, POSIX_ASYNCH is supported - // everywhere in the system. -#if _POSIX_ASYNC_IO == -1 - printf ("_POSIX_ASYNC_IO = -1.. ASYNCH IO NOT supported at all\n"); - return -1; -#else /* Not _POSIX_ASYNC_IO == -1 */ - printf ("_POSIX_ASYNC_IO = %d\n ASYNCH IO is supported FULLY\n", - _POSIX_ASYNC_IO); -#endif /* _POSIX_ASYNC_IO == -1 */ - -#else /* Not defined _POSIX_ASYNC_IO */ - printf ("_POSIX_ASYNC_IO is not defined.\n"); - printf ("AIO might *not* be supported on some paths\n"); -#endif /* _POSIX_ASYNC_IO */ - - // System defined POSIX Values. - printf ("System claims to have POSIX_ASYNCHRONOUS_IO\n"); - - printf ("_POSIX_AIO_LISTIO_MAX = %d\n", _POSIX_AIO_LISTIO_MAX); - printf ("_POSIX_AIO_MAX = %d\n", _POSIX_AIO_MAX); - - // Check and print the run time values. - do_sysconf (); - - return 0; - -#else /* Not _POSIX_ASYNCHRONOUS_IO */ - printf ("No support._POSIX_ASYNCHRONOUS_IO itself is not defined\n"); - return -1; -#endif /* _POSIX_ASYNCHRONOUS_IO */ -} - -int -main (int, char *[]) -{ - if (have_asynchio () == 0) - printf ("Test successful\n"); - else - printf ("Test not successful\n"); - return 0; -} diff --git a/examples/Reactor/Proactor/Makefile b/examples/Reactor/Proactor/Makefile deleted file mode 100644 index 66866cc421f..00000000000 --- a/examples/Reactor/Proactor/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile for aio calls test program. -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = simple_test_proactor test_proactor test_aiosig_ace test_aiocb_ace test_timeout test_timeout_st post_completions test_end_event_loop test_cancel - -#---------------------------------------------------------------------------- -# 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 - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Reactor/Proactor/README b/examples/Reactor/Proactor/README deleted file mode 100644 index 1c857fdc03f..00000000000 --- a/examples/Reactor/Proactor/README +++ /dev/null @@ -1,77 +0,0 @@ -$Id$ - -This README file lists all the example applications for the Proactor framework. - -Test/Example Applications for Proactor: -========================================= - -The following tests are available. - -o $ACE_ROOT/tests/Aio_Platform_Test.cpp : Tests basic limits - pertaining to the POSIX features - -o $ACE_ROOT/examples/Reactor/Proactor/test_aiocb.cpp : - This is a C++ program for testing the AIOCB (AIO Control - Blocks) based completion approach which uses <aio_suspend> for - completion querying. - -o $ACE_ROOT/examples/Reactor/Proactor/test_aiosig.cpp : This is a - C++ program for testing the Signal based completion approach - that uses <sigtimedwait> for completion querying. - -o $ACE_ROOT/examples/Reactor/Proactor/test_aiocb_ace.cpp: Portable - version of test_aiocb.cpp. (Same as test_aiocb.cpp, but uses - ACE_DEBUGs instead of printf's and ACE_Message_Blocks instead - of char*'s. - -o $ACE_ROOT/examples/Reactor/Proactor/test_aiosig_ace.cpp: Portable - version of test_aiosig.cpp. (Same as test_aiosig.cpp, but uses - ACE_DEBUGs instead of printf's and ACE_Message_Blocks instead - of char*'s. - -o test_proactor.cpp (with ACE_POSIX_AIOCB_Proactor) : Test for - ACE_Proactor which uses AIOCB (AIO Control Blocks) based - completions strategy Proactor. (#define - ACE_POSIX_AIOCB_PROACTOR in the config file, but this is the - default option) - -o test_proactor.cpp (with ACE_POSIX_SIG_Proactor) : Test for - ACE_Proactor which uses real time signal based completion - strategy proactor. (#define ACE_POSIX_SIG_PROACTOR in the - config file) - -o test_multiple_loops.cpp : This example application shows how - to write programs that combine the Proactor and Reactor event - loops. This is possible only on WIN32 platform. - -o test_timeout.cpp : Multithreaded application testing the Timers - mechanism of the Proactor. - -o test_timeout_st.cpp : Sinle threaded version of test_timeout.cpp. - -o post_completions.cpp : Tests the completion posting mechanism of - the Proactor. - -o test_end_event_loop.cpp : Tests the event loop mechanism of the - Proactor. - -o test_cancel.cpp : Tests <cancel> interface of the - Asynch_Operation class. - - - -Behavior of POSIX AIO of various platforms: -========================================== - -Sun 5.6 : POSIX4 Real-Time signals implementation is broken in - this platform. - Only POSIX AIOCB Proactor works in this platform. - Therefore, it is not possible to use multiple threads - with in the framework. - -Sun 5.7 : AIOCB and SIG Proactors work fine. - -LynxOS 3.0.0 : <pthread_sigmask> is not available in this - platform. So, only AIOCB Proactor works here. - - diff --git a/examples/Reactor/Proactor/post_completion.dsp b/examples/Reactor/Proactor/post_completion.dsp deleted file mode 100644 index b736965277c..00000000000 --- a/examples/Reactor/Proactor/post_completion.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="post_completion" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=post_completion - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "post_completion.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "post_completion.mak" CFG="post_completion - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "post_completion - Win32 Release" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE "post_completion - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "post_completion - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /machine:I386
-# ADD 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 /machine:I386
-
-!ELSEIF "$(CFG)" == "post_completion - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /out:"post_completion.exe" /pdbtype:sept /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "post_completion - Win32 Release"
-# Name "post_completion - Win32 Debug"
-# Begin Source File
-
-SOURCE=..\post_completions.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Proactor/post_completions.cpp b/examples/Reactor/Proactor/post_completions.cpp deleted file mode 100644 index 0a34134064d..00000000000 --- a/examples/Reactor/Proactor/post_completions.cpp +++ /dev/null @@ -1,291 +0,0 @@ -// $Id$ -// ============================================================================ -// -// = FILENAME -// post_completions.cpp -// -// = DESCRITPTION -// This program demonstrates how to post fake completions to The -// Proactor. It also shows the how to specify the particular -// real-time signals to post completions. The Real-time signal -// based completion strategy is implemented with -// ACE_POSIX_SIG_PROACTOR. -// (So, it can be used only if ACE_HAS_AIO_CALLS is defined and -// ACE_POSIX_AIOCB_PROACTOR is not defined) -// Since it is faking results, you have to pay by knowing and -// using platform-specific implementation objects for Asynchronous -// Result classes. -// This example shows using an arbitrary result class for faking -// completions. You can also use the predefined Result classes for -// faking. The factory methods in the Proactor class create the -// Result objects. -// -// = COMPILATION -// make -// -// = RUN -// ./post_completions -// -// = AUTHOR -// Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ===================================================================== - -#include "ace/Proactor.h" -#include "ace/Synch.h" -#include "ace/Task.h" -#include "ace/WIN32_Proactor.h" -#include "ace/POSIX_Proactor.h" - -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || \ - (defined (ACE_HAS_AIO_CALLS)) && !defined (ACE_POSIX_AIOCB_PROACTOR)) -// This only works on Win32 platforms and on Unix platforms supporting -// POSIX aio calls. - -#if defined (ACE_HAS_AIO_CALLS) -#define RESULT_CLASS ACE_POSIX_Asynch_Result -#elif defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) -#define RESULT_CLASS ACE_WIN32_Asynch_Result -#endif /* ACE_HAS_AIO_CALLS */ - -class My_Result : public RESULT_CLASS -{ - // = TITLE - // - // Result Object that we will post to the Proactor. - // - // = DESCRIPTION - // - -public: - My_Result (ACE_Handler &handler, - const void *act, - int signal_number, - size_t sequence_number) - : RESULT_CLASS (handler, - act, - ACE_INVALID_HANDLE, - 0, // Offset - 0, // OffsetHigh - 0, // Priority - signal_number), - sequence_number_ (sequence_number) - {} - // Constructor. - - virtual ~My_Result (void) - {} - // Destructor. - - void complete (u_long bytes_transferred, - int success, - const void *completion_key, - u_long error) - // This is the method that will be called by the Proactor for - // dispatching the completion. This method generally calls one of - // the call back hood methods defined in the ACE_Handler - // class. But, we will just handle the completions here. - { - this->success_ = success; - this->completion_key_ = completion_key; - this->error_ = error; - - // Print the completion details. - ACE_DEBUG ((LM_DEBUG, - "(%t) Completion sequence number %d, success : %d, error : %d, signal_number : %d\n", - this->sequence_number_, - this->success_, this->error_, this->signal_number ())); - - // Sleep for a while. - ACE_OS::sleep (4); - } - -private: - size_t sequence_number_; - // Sequence number for the result object. -}; - -class My_Handler : public ACE_Handler -{ - // = TITLE - // - // Handler class for faked completions. - // - // = DESCRIPTION - // - -public: - My_Handler (void) {} - // Constructor. - - virtual ~My_Handler (void) {} - // Destructor. - - // ACE_Atomic_Op <ACE_Thread_Mutex, int> completion_count_; - // Count for the completion. -}; - -class My_Task: public ACE_Task <ACE_NULL_SYNCH> -{ - // = TITLE - // - // Contains thread functions which execute event loops. Each - // thread waits for a different signal. - // -public: - My_Task (void) {} - // Constructor. - - virtual ~My_Task (void) {} - // Destructor. - - int open (void *proactor) - { - // Store the proactor. - this->proactor_ = (ACE_Proactor *) proactor; - - // Activate the Task. - this->activate (THR_NEW_LWP, 5); - - return 0; - } - - int svc (void) - { - // Handle events for 13 seconds. - ACE_Time_Value run_time (13); - - ACE_DEBUG ((LM_DEBUG, "(%t):Starting svc routine\n")); - - if (this->proactor_->handle_events (run_time) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t):%p.\n", "Worker::svc"), -1); - - ACE_DEBUG ((LM_DEBUG, "(%t) work complete\n")); - - return 0; - } - -private: - ACE_Proactor *proactor_; - // Proactor for this task. -}; - -int -main (int argc, char *argv []) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P | %t):Test starts \n")); - - // = Get two POSIX_SIG_Proactors, one with SIGRTMIN and one with - // SIGRTMAX. - - ACE_Proactor proactor1; - // Proactor1. SIGRTMIN Proactor. (default). - - // = Proactor2. SIGRTMAX Proactor. -#if defined (ACE_HAS_AIO_CALLS) && !defined (ACE_POSIX_AIOCB_PROACTOR) - - ACE_DEBUG ((LM_DEBUG, "Using ACE_POSIX_SIG_Proactor\n")); - - sigset_t signal_set; - // Signal set that we want to mask. - - // Clear the signal set. - if (sigemptyset (&signal_set) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:%p\n", - "sigemptyset failed"), - 1); - - // Add the SIGRTMAX to the signal set. - if (sigaddset (&signal_set, ACE_SIGRTMAX) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:%p\n", - "sigaddset failed"), - 1); - - // Make the POSIX Proactor. - ACE_POSIX_SIG_Proactor posix_proactor (signal_set); - // Get the Proactor interface out of it. - ACE_Proactor proactor2 (&posix_proactor); -#else /* ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR */ - ACE_Proactor proactor2; -#endif /* ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR */ - - // = Create Tasks. One pool of threads to handle completions on - // SIGRTMIN and the other one to handle completions on SIGRTMAX. - My_Task task1, task2; - task1.open (&proactor1); - task2.open (&proactor2); - - // Handler for completions. - My_Handler handler; - - // = Create a few MyResult objects and post them to Proactor. - - My_Result *result_objects [10]; - int signal_number = ACE_SIGRTMAX; - size_t ri; - - // Creation. - for (ri = 0; ri < 10; ri++) - { - // Use RTMIN and RTMAX proactor alternatively, to post - // completions. - if (ri % 2) - signal_number = ACE_SIGRTMIN; - else - signal_number = ACE_SIGRTMAX; - - // Create the result. - ACE_NEW_RETURN (result_objects [ri], - My_Result (handler, - 0, - signal_number, - ri), - 1); - } - - // Post all the result objects. - ACE_Proactor *proactor = &proactor2; - for (ri = 0; ri < 10; ri++) - { - // Use RTMIN and RTMAX Proactor alternatively, to post - // completions. - if (ri % 2) - proactor = &proactor1; - else - proactor = &proactor2; - - if (result_objects [ri]->post_completion (proactor->implementation ()) - == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Test failed\n"), - 1); - } - - ACE_Thread_Manager::instance ()->wait (); - - ACE_DEBUG ((LM_DEBUG, - "(%P | %t):Test ends\n")); - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Task <ACE_NULL_SYNCH>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Task <ACE_NULL_SYNCH> -#endif /* ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA */ - -#else /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ - -int -main (int, char *[]) -{ - ACE_DEBUG ((LM_DEBUG, - "This example cannot work with AIOCB_Proactor.\n")); - return 1; -} - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ - diff --git a/examples/Reactor/Proactor/post_completions.dsp b/examples/Reactor/Proactor/post_completions.dsp deleted file mode 100644 index 3391d2b1c5a..00000000000 --- a/examples/Reactor/Proactor/post_completions.dsp +++ /dev/null @@ -1,64 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_post_completion" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=test_post_completion - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "post_completions.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "post_completions.mak"\
- CFG="test_post_completion - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "test_post_completion - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "test_pos"
-# PROP BASE Intermediate_Dir "test_pos"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 wsock32.lib aced.lib 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 /pdb:"test_post_completion.pdb" /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
-# SUBTRACT LINK32 /pdb:none
-# Begin Target
-
-# Name "test_post_completion - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "*.cpp"
-# Begin Source File
-
-SOURCE=.\post_completions.cpp
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Proactor/simple_test_proactor.cpp b/examples/Reactor/Proactor/simple_test_proactor.cpp deleted file mode 100644 index b18b39a337a..00000000000 --- a/examples/Reactor/Proactor/simple_test_proactor.cpp +++ /dev/null @@ -1,260 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// simple_test_proactor.cpp -// -// = DESCRIPTION -// Very simple version of test_proactor.cpp. -// -// = AUTHOR -// Alexander Babu Arulanthu (alex@cs.wustl.edu) -// -// ============================================================================ - -#include "ace/Service_Config.h" -#include "ace/Proactor.h" -#include "ace/Asynch_IO.h" -#include "ace/Asynch_IO_Impl.h" -#include "ace/Message_Block.h" -#include "ace/Get_Opt.h" - -ACE_RCSID(Proactor, test_proactor, "$Id$") - -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - // This only works on Win32 platforms and on Unix platforms supporting - // POSIX aio calls. - -static char *file = "simple_test_proactor.cpp"; -static char *dump_file = "simple_output"; -static int initial_read_size = BUFSIZ; -static int done = 0; - -class Simple_Tester : public ACE_Handler -{ - // = TITLE - // - // Simple_Tester - // - // = DESCRIPTION - // - // The class will be created by main(). This class reads a block - // from the file and write that to the dump file. - -public: - Simple_Tester (void); - // Constructor. - - ~Simple_Tester (void); - - int open (void); - // Open the operations and initiate read from the file. - -protected: - // = These methods are called by the freamwork. - - virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); - // This is called when asynchronous reads from the socket complete. - - virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); - // This is called when asynchronous writes from the socket complete. - -private: - int initiate_read_file (void); - - ACE_Asynch_Read_File rf_; - // rf (read file): for writing from the file. - - ACE_Asynch_Write_File wf_; - // ws (write File): for writing to the file. - - ACE_HANDLE input_file_; - // File to read from. - - ACE_HANDLE dump_file_; - // File for dumping data. - - // u_long file_offset_; - // Current file offset - - // u_long file_size_; - // File size -}; - - -Simple_Tester::Simple_Tester (void) - : input_file_ (ACE_INVALID_HANDLE), - dump_file_ (ACE_INVALID_HANDLE) -{ -} - -Simple_Tester::~Simple_Tester (void) -{ -} - - -int -Simple_Tester::open (void) -{ - // Initialize stuff - - // Open input file (in OVERLAPPED mode) - this->input_file_ = ACE_OS::open (file, - GENERIC_READ | FILE_FLAG_OVERLAPPED); - if (this->input_file_ == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); - - // Open dump file (in OVERLAPPED mode) - this->dump_file_ = ACE_OS::open (dump_file, - O_CREAT | O_RDWR | O_TRUNC | FILE_FLAG_OVERLAPPED, - 0644); - if (this->dump_file_ == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); - - // Open ACE_Asynch_Read_File - if (this->rf_.open (*this, this->input_file_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::open"), -1); - - // Open ACE_Asynch_Write_File - if (this->wf_.open (*this, this->dump_file_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::open"), -1); - - ACE_DEBUG ((LM_DEBUG, - "Simple_Tester::open: Files and Asynch Operations opened sucessfully\n")); - - - // Start an asynchronous read file - if (this->initiate_read_file () == -1) - return -1; - - return 0; -} - - -int -Simple_Tester::initiate_read_file (void) -{ - // Create Message_Block - ACE_Message_Block *mb = 0; - ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); - - // Inititiate an asynchronous read from the file - if (this->rf_.read (*mb, - mb->size () - 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::read"), -1); - - ACE_DEBUG ((LM_DEBUG, - "Simple_Tester:initiate_read_file: Asynch Read File issued sucessfully\n")); - - return 0; -} - -void -Simple_Tester::handle_read_file (const ACE_Asynch_Read_File::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_read_file called\n")); - - result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); - - if (result.success ()) - { - // Read successful: write this to the file. - if (this->wf_.write (result.message_block (), - result.bytes_transferred ()) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::write")); - return; - } - } -} - -void -Simple_Tester::handle_write_file (const ACE_Asynch_Write_File::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_write_File called\n")); - - // Reset pointers - result.message_block ().rd_ptr (result.message_block ().rd_ptr () - result.bytes_transferred ()); - - result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); - - done = 1; -} - -static int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, "f:d:"); - int c; - - while ((c = get_opt ()) != EOF) - switch (c) - { - case 'f': - file = get_opt.optarg; - break; - case 'd': - dump_file = get_opt.optarg; - break; - default: - ACE_ERROR ((LM_ERROR, "%p.\n", - "usage :\n" - "-d <dumpfile>\n" - "-f <file>\n")); - return -1; - } - - return 0; -} - -int -main (int argc, char *argv[]) -{ - if (parse_args (argc, argv) == -1) - return -1; - - Simple_Tester Simple_Tester; - - if (Simple_Tester.open () == -1) - return -1; - - int success = 1; - - while (success != -1 && !done) - { - // dispatch events - success = ACE_Proactor::instance ()->handle_events (); - - if (success == 0) - sleep (5); - } - return 0; -} - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/ diff --git a/examples/Reactor/Proactor/test_aiocb.cpp b/examples/Reactor/Proactor/test_aiocb.cpp deleted file mode 100644 index 008121b744a..00000000000 --- a/examples/Reactor/Proactor/test_aiocb.cpp +++ /dev/null @@ -1,230 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// proactor -// -// = FILENAME -// test_aiocb.cpp -// -// = DESCRIPTION -// Checkout $ACE_ROOT/examples/Reactor/Proactor/test_aiocb_ace.cpp, -// which is the ACE'ified version of this program. -// -// = COMPILE and RUN -// % CC -g -o test_aiocb -lrt test_aiocb.cpp -// % ./test_aiocb -// -// = AUTHOR -// Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ============================================================================ - -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <signal.h> -#include <string.h> -#include <errno.h> -#include <stdio.h> -#include <iostream.h> - -#include <aio.h> - -class Test_Aio -{ -public: - Test_Aio (void); - // Default constructor. - - int init (void); - // Initting the output file and the buffer. - - int do_aio (void); - // Doing the testing stuff. - - ~Test_Aio (void); - // Destructor. -private: - int out_fd_; - // Output file descriptor. - - struct aiocb *aiocb_write_; - // For writing to the file. - - struct aiocb *aiocb_read_; - // Reading stuff from the file. - - char *buffer_write_; - // The buffer to be written to the out_fd. - - char *buffer_read_; - // The buffer to be read back from the file. -}; - -Test_Aio::Test_Aio (void) - : aiocb_write_ (new struct aiocb), - aiocb_read_ (new struct aiocb), - buffer_write_ (0), - buffer_read_ (0) -{ -} - -Test_Aio::~Test_Aio (void) -{ - delete aiocb_write_; - delete aiocb_read_; - delete buffer_write_; - delete buffer_read_; -} - -// Init the output file and init the buffer. -int -Test_Aio::init (void) -{ - // Open the output file. - this->out_fd_ = open ("test_aio.log", O_RDWR | O_CREAT | O_TRUNC, 0666); - if (this->out_fd_ == 0) - { - cout << "Error : Opening file" << endl; - return -1; - } - - // Init the buffers. - this->buffer_write_ = strdup ("Welcome to the world of AIO... AIO Rules !!!"); - cout << "The buffer : " << this->buffer_write_ << endl; - this->buffer_read_ = new char [strlen (this->buffer_write_)]; -} - -// Set the necessary things for the AIO stuff. -// Write the buffer asynchly.hmm Disable signals. -// Go on aio_suspend. Wait for completion. -// Print out the result. -int -Test_Aio::do_aio (void) -{ - // = Write to the file. - - // Setup AIOCB. - this->aiocb_write_->aio_fildes = this->out_fd_; - this->aiocb_write_->aio_offset = 0; - this->aiocb_write_->aio_buf = this->buffer_write_; - this->aiocb_write_->aio_nbytes = strlen (this->buffer_write_); - this->aiocb_write_->aio_reqprio = 0; - this->aiocb_write_->aio_sigevent.sigev_notify = SIGEV_NONE; - //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; - this->aiocb_write_->aio_sigevent.sigev_value.sival_ptr = - (void *) this->aiocb_write_; - - // Fire off the aio write. - if (aio_write (this->aiocb_write_) != 0) - { - perror ("aio_write"); - return -1; - } - - // = Read from that file. - - // Setup AIOCB. - this->aiocb_read_->aio_fildes = this->out_fd_; - this->aiocb_read_->aio_offset = 0; - this->aiocb_read_->aio_buf = this->buffer_read_; - this->aiocb_read_->aio_nbytes = strlen (this->buffer_write_); - this->aiocb_read_->aio_reqprio = 0; - this->aiocb_read_->aio_sigevent.sigev_notify = SIGEV_NONE; - //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; - this->aiocb_read_->aio_sigevent.sigev_value.sival_ptr = - (void *) this->aiocb_read_; - - // Fire off the aio write. If it doesnt get queued, carry on to get - // the completion for the first one. - if (aio_read (this->aiocb_read_) < 0) - perror ("aio_read"); - - // Wait for the completion on aio_suspend. - struct aiocb *list_aiocb[2]; - list_aiocb [0] = this->aiocb_write_; - list_aiocb [1] = this->aiocb_read_; - - // Do suspend till all the aiocbs in the list are done. - int done = 0; - int return_val = 0; - while (!done) - { - return_val = aio_suspend (list_aiocb, - 2, - 0); - cerr << "Return value :" << return_val << endl; - - // Analyze return and error values. - if (aio_error (list_aiocb [0]) != EINPROGRESS) - { - if (aio_return (list_aiocb [0]) == -1) - { - perror ("aio_return"); - return -1; - } - else - { - // Successful. Store the pointer somewhere and make the - // entry NULL in the list. - this->aiocb_write_ = list_aiocb [0]; - list_aiocb [0] = 0; - } - } - else - cout << "AIO in progress" << endl; - - if (aio_error (list_aiocb [1]) != EINPROGRESS) - { - if (aio_return (list_aiocb [1]) == -1) - { - perror ("aio_return"); - return -1; - } - else - { - // Successful. Store the pointer somewhere and make the - // entry NULL in the list. - this->aiocb_read_ = list_aiocb [1]; - list_aiocb [1] = 0; - } - } - else - cout << "AIO in progress" << endl; - - // Is it done? - if ((list_aiocb [0] == 0) && (list_aiocb [1] == 0)) - done = 1; - } - - cout << "Both the AIO operations done." << endl; - cout << "The buffer is :" << this->buffer_read_ << endl; - - return 0; -} - -int -main (int argc, char **argv) -{ - Test_Aio test_aio; - - if (test_aio.init () != 0) - { - printf ("AIOCB test failed:\n" - "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"); - return -1; - } - - if (test_aio.do_aio () != 0) - { - printf ("AIOCB test failed:\n" - "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"); - return -1; - } - printf ("AIOCB test successful:\n" - "ACE_POSIX_AIOCB_PROACTOR should work in this platform\n"); - return 0; -} diff --git a/examples/Reactor/Proactor/test_aiocb_ace.cpp b/examples/Reactor/Proactor/test_aiocb_ace.cpp deleted file mode 100644 index c642a1db2aa..00000000000 --- a/examples/Reactor/Proactor/test_aiocb_ace.cpp +++ /dev/null @@ -1,255 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// proactor -// -// = FILENAME -// test_aiocb_ace.cpp -// -// = DESCRIPTION -// This program helps you to test the <aio_*> calls on a -// platform. -// -// Before running this test, make sure the platform can -// support POSIX <aio_> calls, using -// ACE_ROOT/tests/Aio_Platform_Test. -// -// This program tests the AIOCB (AIO Control Blocks) based -// completion approach which uses <aio_suspend> for completion -// querying. -// -// If this test is successful, ACE_POSIX_AIOCB_PROACTOR -// can be used on this platform. -// -// = COMPILE and RUN -// % make -// % ./test_aiocb_ace -// -// = AUTHOR -// Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ============================================================================ - -#include "ace/OS.h" -#include "ace/ACE.h" - -class Test_Aio -{ -public: - Test_Aio (void); - // Default constructor. - - int init (void); - // Initting the output file and the buffer. - - int do_aio (void); - // Doing the testing stuff. - - ~Test_Aio (void); - // Destructor. -private: - int out_fd_; - // Output file descriptor. - - struct aiocb *aiocb_write_; - // For writing to the file. - - struct aiocb *aiocb_read_; - // Reading stuff from the file. - - char *buffer_write_; - // The buffer to be written to the out_fd. - - char *buffer_read_; - // The buffer to be read back from the file. -}; - -Test_Aio::Test_Aio (void) - : aiocb_write_ (0), - aiocb_read_ (0), - buffer_write_ (0), - buffer_read_ (0) -{ - ACE_NEW (this->aiocb_write_, - struct aiocb); - ACE_NEW (this->aiocb_read_, - struct aiocb); -} - -Test_Aio::~Test_Aio (void) -{ - delete aiocb_write_; - delete aiocb_read_; - delete buffer_write_; - delete buffer_read_; -} - -// Init the output file and init the buffer. -int -Test_Aio::init (void) -{ - // Open the output file. - this->out_fd_ = ACE_OS::open ("test_aio.log", - O_RDWR | O_CREAT | O_TRUNC, - 0666); - if (this->out_fd_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Error: Opening file\n"), - -1); - - // Init the buffers. - this->buffer_write_ = ACE::strnew ("Welcome to the world of AIO... AIO Rules !!!"); - ACE_DEBUG ((LM_DEBUG, - "The buffer : %s\n", - this->buffer_write_)); - - // Allocate memory for the read buffer. - ACE_NEW_RETURN (this->buffer_read_, - char [strlen (this->buffer_write_)], - -1); - - return 0; -} - -// Set the necessary things for the AIO stuff. -// Write the buffer asynchly.hmm Disable signals. -// Go on aio_suspend. Wait for completion. -// Print out the result. -int -Test_Aio::do_aio (void) -{ - // = Write to the file. - - // Setup AIOCB. - this->aiocb_write_->aio_fildes = this->out_fd_; - this->aiocb_write_->aio_offset = 0; - this->aiocb_write_->aio_buf = this->buffer_write_; - this->aiocb_write_->aio_nbytes = strlen (this->buffer_write_); - this->aiocb_write_->aio_reqprio = 0; - this->aiocb_write_->aio_sigevent.sigev_notify = SIGEV_NONE; - //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; - this->aiocb_write_->aio_sigevent.sigev_value.sival_ptr = - (void *) this->aiocb_write_; - - // Fire off the aio write. - if (aio_write (this->aiocb_write_) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "aio_write"), - -1); - - // = Read from that file. - - // Setup AIOCB. - this->aiocb_read_->aio_fildes = this->out_fd_; - this->aiocb_read_->aio_offset = 0; - this->aiocb_read_->aio_buf = this->buffer_read_; - this->aiocb_read_->aio_nbytes = strlen (this->buffer_write_); - this->aiocb_read_->aio_reqprio = 0; - this->aiocb_read_->aio_sigevent.sigev_notify = SIGEV_NONE; - //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; - this->aiocb_read_->aio_sigevent.sigev_value.sival_ptr = - (void *) this->aiocb_read_; - - // Fire off the aio write. If it doesnt get queued, carry on to get - // the completion for the first one. - if (aio_read (this->aiocb_read_) < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "aio_read"), - -1); - - // Wait for the completion on aio_suspend. - struct aiocb *list_aiocb[2]; - list_aiocb [0] = this->aiocb_write_; - list_aiocb [1] = this->aiocb_read_; - - // Do suspend till all the aiocbs in the list are done. - int done = 0; - int return_val = 0; - while (!done) - { - return_val = aio_suspend (list_aiocb, - 2, - 0); - ACE_DEBUG ((LM_DEBUG, - "Result of <aio_suspend> : %d\n", - return_val)); - - // Analyze return and error values. - if (aio_error (list_aiocb [0]) != EINPROGRESS) - { - if (aio_return (list_aiocb [0]) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "aio_return"), - -1); - else - { - // Successful. Store the pointer somewhere and make the - // entry NULL in the list. - this->aiocb_write_ = list_aiocb [0]; - list_aiocb [0] = 0; - } - } - else - ACE_DEBUG ((LM_DEBUG, - "aio_error says aio is in progress\n")); - - if (aio_error (list_aiocb [1]) != EINPROGRESS) - { - if (aio_return (list_aiocb [1]) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "aio_return"), - -1); - else - { - // Successful. Store the pointer somewhere and make the - // entry NULL in the list. - this->aiocb_read_ = list_aiocb [1]; - list_aiocb [1] = 0; - } - } - else - ACE_DEBUG ((LM_DEBUG, - "aio_error says aio is in progress\n")); - - // Is it done? - if ((list_aiocb [0] == 0) && (list_aiocb [1] == 0)) - done = 1; - } - - ACE_DEBUG ((LM_DEBUG, - "Both the AIO operations done.\n" - "The buffer is : %s\n", - this->buffer_read_)); - - return 0; -} - -int -main (int argc, char **argv) -{ - Test_Aio test_aio; - - if (test_aio.init () != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "AIOCB test failed:\n" - "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"), - -1); - - if (test_aio.do_aio () != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "AIOCB test failed:\n" - "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"), - -1); - - ACE_DEBUG ((LM_DEBUG, - "AIOCB test successful:\n" - "ACE_POSIX_AIOCB_PROACTOR should work in this platform\n")); - - return 0; -} diff --git a/examples/Reactor/Proactor/test_aiosig.cpp b/examples/Reactor/Proactor/test_aiosig.cpp deleted file mode 100644 index 1746a10a49c..00000000000 --- a/examples/Reactor/Proactor/test_aiosig.cpp +++ /dev/null @@ -1,294 +0,0 @@ -// $Id$ -// ============================================================================ -// -// = FILENAME -// test_aiosig.cpp -// -// = DESCRITPTION -// Check out test_aiosig_ace.cpp, the ACE'ified version of this -// program. This program may not be uptodate. -// -// = COMPILATION -// CC -g -o test_aiosig -lrt test_aiosig.cpp -// -// = RUN -// ./test_aiosig -// -// = AUTHOR -// Programming for the Real World. Bill O. GallMeister. -// Modified by Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ===================================================================== - - -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <signal.h> -#include <string.h> -#include <errno.h> -#include <stdio.h> - -#include <limits.h> - -#include <aio.h> - -int file_handle = -1; -char mb1 [BUFSIZ + 1]; -char mb2 [BUFSIZ + 1]; -aiocb aiocb1, aiocb2; -sigset_t completion_signal; - -// Function prototypes. -int setup_signal_delivery (void); -int issue_aio_calls (void); -int query_aio_completions (void); -int test_aio_calls (void); -int setup_signal_handler (void); -int setup_signal_handler (int signal_number); - -int -setup_signal_delivery (void) -{ - // Make the sigset_t consisting of the completion signal. - if (sigemptyset (&completion_signal) == -1) - { - perror ("Error:Couldnt init the RT completion signal set\n"); - return -1; - } - - if (sigaddset (&completion_signal, SIGRTMIN) == -1) - { - perror ("Error:Couldnt init the RT completion signal set\n"); - return -1; - } - - // Mask them. - if (pthread_sigmask (SIG_BLOCK, &completion_signal, 0) == -1) - { - perror ("Error:Couldnt maks the RT completion signals\n"); - return -1; - } - - return setup_signal_handler (SIGRTMIN); -} - -int -issue_aio_calls (void) -{ - // Setup AIOCB. - aiocb1.aio_fildes = file_handle; - aiocb1.aio_offset = 0; - aiocb1.aio_buf = mb1; - aiocb1.aio_nbytes = BUFSIZ; - aiocb1.aio_reqprio = 0; - aiocb1.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocb1.aio_sigevent.sigev_signo = SIGRTMIN; - aiocb1.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb1; - - // Fire off the aio write. - if (aio_read (&aiocb1) == -1) - { - // Queueing failed. - perror ("Error:Asynch_Read_Stream: aio_read queueing failed\n"); - return -1; - } - - // Setup AIOCB. - aiocb2.aio_fildes = file_handle; - aiocb2.aio_offset = BUFSIZ + 1; - aiocb2.aio_buf = mb2; - aiocb2.aio_nbytes = BUFSIZ; - aiocb2.aio_reqprio = 0; - aiocb2.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocb2.aio_sigevent.sigev_signo = SIGRTMIN; - aiocb2.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb2; - - // Fire off the aio write. - if (aio_read (&aiocb2) == -1) - { - // Queueing failed. - perror ("Error:Asynch_Read_Stream: aio_read queueing failed\n"); - return -1; - } - return 0; -} - -int -query_aio_completions (void) -{ - int result = 0; - size_t number_of_compleions = 0; - for (number_of_compleions = 0; - number_of_compleions < 2; - number_of_compleions ++) - { - // Wait for <milli_seconds> amount of time. - // @@ Assigning <milli_seconds> to tv_sec. - timespec timeout; - timeout.tv_sec = INT_MAX; - timeout.tv_nsec = 0; - - // To get back the signal info. - siginfo_t sig_info; - - // Await the RT completion signal. - int sig_return = sigtimedwait (&completion_signal, - &sig_info, - &timeout); - - // Error case. - // If failure is coz of timeout, then return *0* but set - // errno appropriately. This is what the WinNT proactor - // does. - if (sig_return == -1) - { - perror ("Error:Error waiting for RT completion signals\n"); - return -1; - } - - // RT completion signals returned. - if (sig_return != SIGRTMIN) - { - printf ("Unexpected signal (%d) has been received while waiting for RT Completion Signals\n", - sig_return); - return -1; - } - - // @@ Debugging. - printf ("Sig number found in the sig_info block : %d\n", - sig_info.si_signo); - - // Is the signo returned consistent? - if (sig_info.si_signo != sig_return) - { - printf ("Inconsistent signal number (%d) in the signal info block\n", - sig_info.si_signo); - return -1; - } - - // @@ Debugging. - printf ("Signal code for this signal delivery : %d\n", - sig_info.si_code); - - // Is the signal code an aio completion one? - if ((sig_info.si_code != SI_ASYNCIO) && - (sig_info.si_code != SI_QUEUE)) - { - printf ("Unexpected signal code (%d) returned on completion querying\n", - sig_info.si_code); - return -1; - } - - // Retrive the aiocb. - aiocb* aiocb_ptr = (aiocb *) sig_info.si_value.sival_ptr; - - // Analyze error and return values. Return values are - // actually <errno>'s associated with the <aio_> call - // corresponding to aiocb_ptr. - int error_code = aio_error (aiocb_ptr); - if (error_code == -1) - { - perror ("Error:Invalid control block was sent to <aio_error> for compleion querying\n"); - return -1; - } - - if (error_code != 0) - { - // Error occurred in the <aio_>call. Return the errno - // corresponding to that <aio_> call. - printf ("Error:An AIO call has failed:Error code = %d\n", - error_code); - return -1; - } - - // No error occured in the AIO operation. - int nbytes = aio_return (aiocb_ptr); - if (nbytes == -1) - { - perror ("Error:Invalid control block was send to <aio_return>\n"); - return -1; - } - - if (number_of_compleions == 0) - // Print the buffer. - printf ("Number of bytes transferred : %d\n The buffer : %s \n", - nbytes, - mb1); - else - // Print the buffer. - printf ("Number of bytes transferred : %d\n The buffer : %s \n", - nbytes, - mb2); - } - return 0; -} - -int -test_aio_calls (void) -{ - // Set up the input file. - // Open file (in SEQUENTIAL_SCAN mode) - file_handle = open ("test_aiosig.cpp", O_RDONLY); - - if (file_handle == -1) - { - perror ("Error:Opening the inputfile"); - return -1; - } - - if (setup_signal_delivery () < 0) - return -1; - - if (issue_aio_calls () < 0) - return -1; - - if (query_aio_completions () < 0) - return -1; - - return 0; -} - -int -setup_signal_handler (int signal_number) -{ - // Setting up the handler(!) for these signals. - struct sigaction reaction; - sigemptyset (&reaction.sa_mask); // Nothing else to mask. - reaction.sa_flags = SA_SIGINFO; // Realtime flag. -#if defined (SA_SIGACTION) - // Lynx says, it is better to set this bit to be portable. - reaction.sa_flags &= SA_SIGACTION; -#endif /* SA_SIGACTION */ - reaction.sa_sigaction = null_handler; // Null handler. - int sigaction_return = sigaction (SIGRTMIN, - &reaction, - 0); - if (sigaction_return == -1) - { - perror ("Error:Proactor couldnt do sigaction for the RT SIGNAL"); - return -1; - } - - return 0; -} - -void -null_handler (int /* signal_number */, - siginfo_t * /* info */, - void * /* context */) -{ -} - -int -main (int, char *[]) -{ - if (test_aio_calls () == 0) - printf ("RT SIG test successful:\n" - "ACE_POSIX_SIG_PROACTOR should work in this platform\n"); - else - printf ("RT SIG test failed:\n" - "ACE_POSIX_SIG_PROACTOR may not work in this platform\n"); - return 0; -} diff --git a/examples/Reactor/Proactor/test_aiosig_ace.cpp b/examples/Reactor/Proactor/test_aiosig_ace.cpp deleted file mode 100644 index bfb36d78b46..00000000000 --- a/examples/Reactor/Proactor/test_aiosig_ace.cpp +++ /dev/null @@ -1,312 +0,0 @@ -// $Id$ -// ============================================================================ -// -// = FILENAME -// test_aiosig_sig.cpp -// -// = DESCRITPTION -// This program helps you to test the <aio_*> calls on a -// platform. -// Before running this test, make sure the platform can -// support POSIX <aio_> calls, using ACE_ROOT/tests/Aio_Plaform_Test.cpp -// -// This program tests the Signal based completion approach which -// uses <sigtimedwait> for completion querying. -// If this test is successful, ACE_POSIX_SIG_PROACTOR -// can be used on this platform. -// -// This program is a ACE version of the -// $ACE_ROOT/examples/Reactor/Proactor/test_aiosig.cpp, with -// ACE_DEBUGs and Message_Blocks. -// -// This test does the following: -// Issue two <aio_read>s. -// Assign SIGRTMIN as the notification signal. -// Mask these signals from delivery. -// Receive this signal by doing <sigtimedwait>. -// Wait for two completions (two signals) -// -// = COMPILATION -// make -// -// = RUN -// ./test_aiosig_ace -// -// = AUTHOR -// Programming for the Real World. Bill O. GallMeister. -// Modified by Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ===================================================================== - -#include "ace/Message_Block.h" - -static ACE_HANDLE file_handle = ACE_INVALID_HANDLE; -static ACE_Message_Block mb1 (BUFSIZ + 1); -static ACE_Message_Block mb2 (BUFSIZ + 1); -static aiocb aiocb1; -static aiocb aiocb2; -static sigset_t completion_signal; - -// Function prototypes. -static int setup_signal_delivery (void); -static int issue_aio_calls (void); -static int query_aio_completions (void); -static int test_aio_calls (void); -static void null_handler (int signal_number, siginfo_t *info, void *context); -static int setup_signal_handler (int signal_number); - -static int -setup_signal_delivery (void) -{ - // = Mask all the signals. - - sigset_t full_set; - - // Get full set. - if (sigfillset (&full_set) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:(%P | %t):%p\n", - "sigfillset failed"), - -1); - - // Mask them. - if (ACE_OS::pthread_sigmask (SIG_SETMASK, &full_set, 0) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:(%P | %t):%p\n", - "pthread_sigmask failed"), - -1); - - // = Make a mask with SIGRTMIN only. We use only that signal to - // issue <aio_>'s. - - if (sigemptyset (&completion_signal) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:%p:Couldnt init the RT completion signal set\n"), - -1); - - if (sigaddset (&completion_signal, - SIGRTMIN) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:%p:Couldnt init the RT completion signal set\n"), - -1); - - // Set up signal handler for this signal. - return setup_signal_handler (SIGRTMIN); -} - -static int -setup_signal_handler (int signal_number) -{ - // Setting up the handler(!) for these signals. - struct sigaction reaction; - sigemptyset (&reaction.sa_mask); // Nothing else to mask. - reaction.sa_flags = SA_SIGINFO; // Realtime flag. -#if defined (SA_SIGACTION) - // Lynx says, it is better to set this bit to be portable. - reaction.sa_flags &= SA_SIGACTION; -#endif /* SA_SIGACTION */ - reaction.sa_sigaction = null_handler; // Null handler. - int sigaction_return = sigaction (SIGRTMIN, - &reaction, - 0); - if (sigaction_return == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:%p:Proactor couldnt do sigaction for the RT SIGNAL"), - -1); - return 0; -} - - -static int -issue_aio_calls (void) -{ - // Setup AIOCB. - aiocb1.aio_fildes = file_handle; - aiocb1.aio_offset = 0; - aiocb1.aio_buf = mb1.wr_ptr (); - aiocb1.aio_nbytes = BUFSIZ; - aiocb1.aio_reqprio = 0; - aiocb1.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocb1.aio_sigevent.sigev_signo = SIGRTMIN; - aiocb1.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb1; - - // Fire off the aio write. - if (aio_read (&aiocb1) == -1) - // Queueing failed. - ACE_ERROR_RETURN ((LM_ERROR, - "Erro:%p:Asynch_Read_Stream: aio_read queueing failed\n"), - -1); - - // Setup AIOCB. - aiocb2.aio_fildes = file_handle; - aiocb2.aio_offset = BUFSIZ + 1; - aiocb2.aio_buf = mb2.wr_ptr (); - aiocb2.aio_nbytes = BUFSIZ; - aiocb2.aio_reqprio = 0; - aiocb2.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocb2.aio_sigevent.sigev_signo = SIGRTMIN; - aiocb2.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb2; - - // Fire off the aio write. - if (aio_read (&aiocb2) == -1) - // Queueing failed. - ACE_ERROR_RETURN ((LM_ERROR, - "Erro:%p:Asynch_Read_Stream: aio_read queueing failed\n"), - -1); - - return 0; -} - -static int -query_aio_completions (void) -{ - for (size_t number_of_compleions = 0; - number_of_compleions < 2; - number_of_compleions ++) - { - // Wait for <milli_seconds> amount of time. @@ Assigning - // <milli_seconds> to tv_sec. - timespec timeout; - timeout.tv_sec = ACE_INFINITE; - timeout.tv_nsec = 0; - - // To get back the signal info. - siginfo_t sig_info; - - // Await the RT completion signal. - int sig_return = sigtimedwait (&completion_signal, - &sig_info, - &timeout); - - // Error case. - // If failure is coz of timeout, then return *0* but set - // errno appropriately. This is what the WinNT proactor - // does. - if (sig_return == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "Error:%p:Error waiting for RT completion signals\n"), - -1); - - // RT completion signals returned. - if (sig_return != SIGRTMIN) - ACE_ERROR_RETURN ((LM_ERROR, - "Unexpected signal (%d) has been received while waiting for RT Completion Signals\n", - sig_return), - -1); - - // @@ Debugging. - ACE_DEBUG ((LM_DEBUG, - "Sig number found in the sig_info block : %d\n", - sig_info.si_signo)); - - // Is the signo returned consistent? - if (sig_info.si_signo != sig_return) - ACE_ERROR_RETURN ((LM_ERROR, - "Inconsistent signal number (%d) in the signal info block\n", - sig_info.si_signo), - -1); - - // @@ Debugging. - ACE_DEBUG ((LM_DEBUG, - "Signal code for this signal delivery : %d\n", - sig_info.si_code)); - - // Is the signal code an aio completion one? - if ((sig_info.si_code != SI_ASYNCIO) && - (sig_info.si_code != SI_QUEUE)) - ACE_ERROR_RETURN ((LM_DEBUG, - "Unexpected signal code (%d) returned on completion querying\n", - sig_info.si_code), - -1); - - // Retrive the aiocb. - aiocb* aiocb_ptr = (aiocb *) sig_info.si_value.sival_ptr; - - // Analyze error and return values. Return values are - // actually <errno>'s associated with the <aio_> call - // corresponding to aiocb_ptr. - int error_code = aio_error (aiocb_ptr); - if (error_code == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p:Invalid control block was sent to <aio_error> for compleion querying\n"), - -1); - - if (error_code != 0) - // Error occurred in the <aio_>call. Return the errno - // corresponding to that <aio_> call. - ACE_ERROR_RETURN ((LM_ERROR, - "%p:An AIO call has failed\n"), - error_code); - - // No error occured in the AIO operation. - int nbytes = aio_return (aiocb_ptr); - if (nbytes == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p:Invalid control block was send to <aio_return>\n"), - -1); - if (number_of_compleions == 0) - // Print the buffer. - ACE_DEBUG ((LM_DEBUG, - "\n Number of bytes transferred : %d\n The buffer : %s \n", - nbytes, - mb1.rd_ptr ())); - else - // Print the buffer. - ACE_DEBUG ((LM_DEBUG, - "\n Number of bytes transferred : %d\n The buffer : %s \n", - nbytes, - mb2.rd_ptr ())); - } - - return 0; -} - -static int -test_aio_calls (void) -{ - // Set up the input file. - // Open file (in SEQUENTIAL_SCAN mode) - file_handle = ACE_OS::open ("test_aiosig_ace.cpp", - O_RDONLY); - - if (file_handle == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "ACE_OS::open"), - -1); - - if (setup_signal_delivery () == -1) - return -1; - - if (issue_aio_calls () == -1) - return -1; - - if (query_aio_completions () == -1) - return -1; - - return 0; -} - -static void -null_handler (int signal_number, - siginfo_t */* info */, - void * /* context */) -{ - ACE_ERROR ((LM_ERROR, - "Error:%s:Signal number %d\n" - "Mask all the RT signals for this thread", - "ACE_POSIX_SIG_Proactor::null_handler called", - signal_number)); -} - -int -main (int, char *[]) -{ - if (test_aio_calls () == 0) - printf ("RT SIG test successful:\n" - "ACE_POSIX_SIG_PROACTOR should work in this platform\n"); - else - printf ("RT SIG test failed:\n" - "ACE_POSIX_SIG_PROACTOR may not work in this platform\n"); - return 0; -} diff --git a/examples/Reactor/Proactor/test_cancel.cpp b/examples/Reactor/Proactor/test_cancel.cpp deleted file mode 100644 index d022613c3a2..00000000000 --- a/examples/Reactor/Proactor/test_cancel.cpp +++ /dev/null @@ -1,274 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_cancel.cpp -// -// = DESCRIPTION -// This program tests cancelling an Asynchronous Operation in the -// Proactor framework. -// -// This tests accepts a connection and issues an Asynchronous Read -// Stream. It reads <read_size> (option -s) number of bytes and -// when this operation completes, it issues another Asynchronous -// Read Stream to <read_size> and immediately calls <cancel> to -// cancel the operation and so the program exits closing the -// connection. -// -// Works fine on NT. On Solaris platforms, the asynch read is -// pending, but the cancel returns with the value <AIO_ALLDONE> -// indicating all the operations in that handle are done. -// But, LynxOS has a good <aio_cancel> implementation. It works -// fine. -// -// = RUN -// ./test_cancel -p <port_number> -// Then telnet to this port and send <read_size> bytes and your -// connection should get closed down. -// -// = AUTHOR -// Irfan Pyarali (irfan@cs.wustl.edu) -// -// ============================================================================ - -#include "ace/Service_Config.h" -#include "ace/Proactor.h" -#include "ace/Asynch_IO.h" -#include "ace/Asynch_IO_Impl.h" -#include "ace/Asynch_Acceptor.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_Connector.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Stream.h" -#include "ace/Message_Block.h" -#include "ace/Get_Opt.h" -#include "ace/streams.h" - -ACE_RCSID (Proactor, test_proactor, "$Id$") - -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - // This only works on Win32 platforms and on Unix platforms supporting - // POSIX aio calls. - -static u_short port = ACE_DEFAULT_SERVER_PORT; -static int done = 0; -static int read_size = 2; - -class Receiver : public ACE_Service_Handler -{ - // = TITLE - // - // Receiver - // - // = DESCRIPTION - // - // The class will be created by ACE_Asynch_Acceptor when new - // connections arrive. This class will then receive data from - // the network connection and dump it to a file. - -public: - Receiver (void); - ~Receiver (void); - - virtual void open (ACE_HANDLE handle, - ACE_Message_Block &message_block); - // This is called after the new connection has been accepted. - -protected: - // These methods are called by the framework - - virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); - // This is called when asynchronous read from the socket complete - -private: - ACE_Asynch_Read_Stream rs_; - // rs (read stream): for reading from a socket - - ACE_Message_Block mb_; - // Message block to read from the stream. - - ACE_HANDLE handle_; - // Handle for IO to remote peer -}; - -Receiver::Receiver (void) - : mb_ (read_size + 1), - handle_ (ACE_INVALID_HANDLE) -{ -} - -Receiver::~Receiver (void) -{ - ACE_DEBUG ((LM_DEBUG, - "Receiver: Closing down Remote connection:%d\n", - this->handle_)); - - ACE_OS::closesocket (this->handle_); -} - -void -Receiver::open (ACE_HANDLE handle, - ACE_Message_Block &message_block) -{ - // New connection, initiate stuff - - ACE_DEBUG ((LM_DEBUG, "%N:%l:Receiver::open called\n")); - - // Cache the new connection - this->handle_ = handle; - - // Initiate ACE_Asynch_Read_Stream - if (this->rs_.open (*this, this->handle_) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::open")); - return; - } - - // Try to read <n> bytes from the stream. - - ACE_DEBUG ((LM_DEBUG, - "Receiver::open: Issuing Asynch Read of (%d) bytes from the stream\n", - read_size)); - - if (this->rs_.read (this->mb_, - read_size) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "Receiver::open: Failed to issue the read")); -} - -void -Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); - - // Reset pointers - result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); - - if (result.success () && !result.error ()) - { - // Successful read: No error. - - // Set the pointers back in the message block. - result.message_block ().wr_ptr (result.message_block ().rd_ptr ()); - - // Issue another read, but immediately cancel it. - - // Issue the read. - - ACE_DEBUG ((LM_DEBUG, - "Issuing Asynch Read of (%d) bytes from the stream\n", - read_size)); - - if (this->rs_.read (this->mb_, - read_size) == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "Receiver::handle_read_stream: Failed to issue the read")); - - // Cancel the read. - - ACE_DEBUG ((LM_DEBUG, - "Cacelling Asynch Read ")); - - int ret_val = this->rs_.cancel (); - if (ret_val == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "Receiver::handle_read_stream: Failed to cancel the read")); - - ACE_DEBUG ((LM_DEBUG, "Asynch IO : Cancel : Result = %d\n", - ret_val)); - } - else - { - done = 1; - - ACE_DEBUG ((LM_DEBUG, "Receiver completed\n")); - - // Print the error message if any. - if (result.error () != 0) - { - errno = result.error (); - - ACE_ERROR ((LM_ERROR, - "%p\n", - "Asynch Read Stream Error: ")); - } - } -} - -static int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, "p:s:"); - int c; - - while ((c = get_opt ()) != EOF) - switch (c) - { - case 'p': - port = ACE_OS::atoi (get_opt.optarg); - break; - case 's': - read_size = ACE_OS::atoi (get_opt.optarg); - break; - default: - ACE_ERROR ((LM_ERROR, "%p.\n", - "usage :\n" - "-p <port>\n" - "-s <read_size>\n")); - return -1; - } - - return 0; -} - -int -main (int argc, char *argv[]) -{ - if (parse_args (argc, argv) == -1) - return -1; - - // Note: acceptor parameterized by the Receiver - ACE_Asynch_Acceptor<Receiver> acceptor; - - // Listening passively. - if (acceptor.open (ACE_INET_Addr (port), - read_size, - 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "ACE:acceptor::open failed\n"), - 1); - - int success = 1; - - while (success > 0 && !done) - // dispatch events - success = ACE_Proactor::instance ()->handle_events (); - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Asynch_Acceptor<Receiver>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Asynch_Acceptor<Receiver> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/ diff --git a/examples/Reactor/Proactor/test_cancel.dsp b/examples/Reactor/Proactor/test_cancel.dsp deleted file mode 100644 index 49ddc9a40b8..00000000000 --- a/examples/Reactor/Proactor/test_cancel.dsp +++ /dev/null @@ -1,61 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_cancel" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=test_cancel - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "test_cancel.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "test_cancel.mak" CFG="test_cancel - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "test_cancel - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "test_can"
-# PROP BASE Intermediate_Dir "test_can"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "test_cancel - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "*.cpp"
-# Begin Source File
-
-SOURCE=.\test_cancel.cpp
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Proactor/test_end_event_loop.cpp b/examples/Reactor/Proactor/test_end_event_loop.cpp deleted file mode 100644 index d864a6a3293..00000000000 --- a/examples/Reactor/Proactor/test_end_event_loop.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// $Id$ -// ============================================================================ -// -// = FILENAME -// test_end_event_loop.cpp -// -// = DESCRITPTION -// This program tests the event loop mechanism of the -// Proactor. To end the event loop, threads that are blocked in -// waiting for completions are woken up and the event loop comes -// to the end. This is tested in this program. -// -// Threads are doing <run_event_loop> with/without time_out -// values and the main thread calls <end_event_loop>. -// -// = COMPILATION -// make -// -// = RUN -// ./test_end_event_loop -// -// = AUTHOR -// Alexander Babu Arulanthu <alex@cs.wustl.edu> -// -// ===================================================================== - -#include "ace/Proactor.h" -#include "ace/Synch.h" -#include "ace/Task.h" -#include "ace/WIN32_Proactor.h" -#include "ace/POSIX_Proactor.h" - -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || \ - (defined (ACE_HAS_AIO_CALLS)) && !defined (ACE_POSIX_AIOCB_PROACTOR)) -// This only works on Win32 platforms and on Unix platforms supporting -// POSIX aio calls. - -class My_Task: public ACE_Task <ACE_NULL_SYNCH> -{ - // = TITLE - // - // Contains thread functions which execute event loops. Each - // thread waits for a different signal. - // -public: - // Constructor. - My_Task (void) - : time_flag_ (0) - {} - - - virtual ~My_Task (void) {} - // Destructor. - - // If time_flag is zero do the eventloop indefinitely, otherwise do - // it for finite amount of time (13secs!!!). - int open (void *timed_event_loop) - { - // Set the local variable. - if (timed_event_loop == 0) - this->time_flag_ = 0; - else - this->time_flag_ = 1; - - // Spawn the threads. - if (this->activate (THR_NEW_LWP, 5) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%N:%l:%p\n", - "My_Task:open: <activate> failed"), - -1); - - return 0; - } - - // Thread function. - int svc (void) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t):Starting svc routine\n")); - - if (this->time_flag_) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t):Going to do *timed* <run_event_loop> \n")); - - ACE_Time_Value run_time (13); - - if (ACE_Proactor::instance ()->run_event_loop (run_time) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t):%p.\n", - "<Proactor::run_event_loop> failed"), - -1); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t):Going to do *indefinite* <run_event_loop> \n")); - - if (ACE_Proactor::instance ()->run_event_loop () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t):%p.\n", - "<Proactor::run_event_loop> failed"), - -1); - } - return 0; - }; - -private: - int time_flag_; - // If zero, indefinite event loop, otherwise timed event loop. -}; - -int -main (int argc, char *argv []) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P | %t):Test starts \n")); - - // Let us get the singleton proactor created here. This is very - // important. This will mask the signal used in the Proactor masked - // for the main thread (and all the threads). - ACE_Proactor *proactor = ACE_Proactor::instance (); - ACE_UNUSED_ARG (proactor); - - My_Task task1, task2; - - // Test the indefinite run event loop. - if (task1.open (0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%N:%l:(%P | %t):Failed to <open> the task\n"), - 1); - - // Test the indefinite run event loop. Just pass a non-zero. - if (task2.open ((void *)&task2) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%N:%l:(%P | %t):Failed to <open> the task\n"), - 1); - - // Give a gap. - ACE_OS::sleep (3); - - // End the event loop. - if (ACE_Proactor::instance ()->end_event_loop () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%N:%l:(%P | %t):Failed to <end_event_loop>\n"), - 1); - - ACE_Thread_Manager::instance ()->wait (); - - ACE_DEBUG ((LM_DEBUG, - "(%P | %t):Test ends\n")); - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Task <ACE_NULL_SYNCH>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Task <ACE_NULL_SYNCH> -#endif /* ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA */ - -#else /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ - -int -main (int, char *[]) -{ - ACE_DEBUG ((LM_DEBUG, - "This example cannot work with AIOCB_Proactor.\n")); - return 1; -} - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ - diff --git a/examples/Reactor/Proactor/test_end_event_loop.dsp b/examples/Reactor/Proactor/test_end_event_loop.dsp deleted file mode 100644 index d06cf6e318b..00000000000 --- a/examples/Reactor/Proactor/test_end_event_loop.dsp +++ /dev/null @@ -1,60 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_end_event_loop" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=test_end_event_loop - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "test_end_event_loop.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "test_end_event_loop.mak"\
- CFG="test_end_event_loop - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "test_end_event_loop - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "test_end"
-# PROP BASE Intermediate_Dir "test_end"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /o"ttest_end_event_loop.bsc"
-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 /libpath:"..\..\..\ace"
-# SUBTRACT LINK32 /pdb:none
-# Begin Target
-
-# Name "test_end_event_loop - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_end_event_loop.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/Proactor/test_multiple_loops.cpp b/examples/Reactor/Proactor/test_multiple_loops.cpp deleted file mode 100644 index ca6cd9ea43e..00000000000 --- a/examples/Reactor/Proactor/test_multiple_loops.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_multiple_loops.cpp -// -// = DESCRIPTION -// -// This example application shows how to write programs that -// combine the Proactor and Reactor event loops. This is possible -// only on WIN32 platform. -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Synch.h" -#include "ace/Task.h" -#include "ace/Proactor.h" -#include "ace/WIn32_Proactor.h" - -ACE_RCSID(Proactor, test_multiple_loops, "$Id$") - -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) - -class Timeout_Handler : public ACE_Handler, public ACE_Event_Handler -{ - // = TITLE - // Generic timeout handler. - -public: - Timeout_Handler (void) - { - } - - // This is called by the Proactor. This is declared in ACE_Handler. - virtual void handle_time_out (const ACE_Time_Value &tv, - const void *arg) - { - // Print out when timeouts occur. - ACE_DEBUG ((LM_DEBUG, "(%t) %d timeout occurred for %s @ %d.\n", - ++count_, - (char *) arg, - tv.sec ())); - - // Since there is only one thread that can do the timeouts in - // Reactor, lets keep the handle_timeout short for that - // thread. - if (ACE_OS::strcmp ((char *) arg, "Proactor") == 0) - // Sleep for a while - ACE_OS::sleep (1); - } - - // This method is declared in ACE_Event_Handler. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg) - { - this->handle_time_out (tv, arg); - return 0; - } - -private: - ACE_Atomic_Op <ACE_Thread_Mutex, int> count_; -}; - -class Worker : public ACE_Task <ACE_NULL_SYNCH> -{ -public: - - // Thread fuction. - int svc (void) - { - ACE_DEBUG ((LM_DEBUG, "(%t) Worker started\n")); - - // Handle events for 13 seconds. - ACE_Time_Value run_time (13); - - // Try to become the owner - ACE_Reactor::instance ()->owner (ACE_Thread::self ()); - - if (ACE_Reactor::run_event_loop (run_time) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "Worker::svc"), -1); - else - ACE_DEBUG ((LM_DEBUG, "(%t) work complete\n")); - - return 0; - } -}; - -int -main (int, char *[]) -{ - Timeout_Handler handler; - ACE_WIN32_Proactor win32_proactor (0, 1); - ACE_Proactor proactor (&win32_proactor, 0, 0); - - ACE_Reactor::instance ()->register_handler (proactor.implementation ()); - - // Register a 2 second timer. - ACE_Time_Value foo_tv (2); - if (proactor.schedule_timer (handler, - (void *) "Proactor", - ACE_Time_Value::zero, - foo_tv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - - // Register a 3 second timer. - ACE_Time_Value bar_tv (3); - if (ACE_Reactor::instance ()->schedule_timer (&handler, - (void *) "Reactor", - ACE_Time_Value::zero, - bar_tv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - - Worker worker; - - if (worker.activate (THR_NEW_LWP, 10) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); - - ACE_Thread_Manager::instance ()->wait (); - - // Remove from reactor - ACE_Reactor::instance ()->remove_handler (&proactor, - ACE_Event_Handler::DONT_CALL); - - return 0; -} - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ diff --git a/examples/Reactor/Proactor/test_multiple_loops.dsp b/examples/Reactor/Proactor/test_multiple_loops.dsp deleted file mode 100644 index ad1b472f639..00000000000 --- a/examples/Reactor/Proactor/test_multiple_loops.dsp +++ /dev/null @@ -1,71 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_multiple_loops" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=test_multiple_loops - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "test_multiple_loops.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "test_multiple_loops.mak"\
- CFG="test_multiple_loops - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "test_multiple_loops - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\test_multiple_loops\Debug"
-# PROP BASE Intermediate_Dir ".\test_multiple_loops\Debug"
-# PROP BASE Target_Dir ".\test_multiple_loops"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ".\test_multiple_loops"
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "test_multiple_loops - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\test_multiple_loops.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Proactor/test_proactor.cpp b/examples/Reactor/Proactor/test_proactor.cpp deleted file mode 100644 index 89fe5e67ef2..00000000000 --- a/examples/Reactor/Proactor/test_proactor.cpp +++ /dev/null @@ -1,620 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_proactor.cpp -// -// = DESCRIPTION -// This program illustrates how the ACE_Proactor can be used to -// implement an application that does various asynchronous -// operations. -// -// = AUTHOR -// Irfan Pyarali (irfan@cs.wustl.edu) -// -// ============================================================================ - -#include "ace/Service_Config.h" -#include "ace/Proactor.h" -#include "ace/Asynch_IO.h" -#include "ace/Asynch_IO_Impl.h" -#include "ace/Asynch_Acceptor.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_Connector.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Stream.h" -#include "ace/Message_Block.h" -#include "ace/Get_Opt.h" -#include "ace/streams.h" - -ACE_RCSID(Proactor, test_proactor, "$Id$") - -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - // This only works on Win32 platforms and on Unix platforms supporting - // POSIX aio calls. - -static char *host = 0; -static u_short port = ACE_DEFAULT_SERVER_PORT; -static char *file = "test_proactor.cpp"; -static char *dump_file = "output"; -static int done = 0; -static int initial_read_size = BUFSIZ; - -class Receiver : public ACE_Service_Handler - // - // = TITLE - // - // Receiver - // - // = DESCRIPTION - // - // The class will be created by ACE_Asynch_Acceptor when new - // connections arrive. This class will then receive data from - // the network connection and dump it to a file. -{ -public: - Receiver (void); - ~Receiver (void); - - virtual void open (ACE_HANDLE handle, - ACE_Message_Block &message_block); - // This is called after the new connection has been accepted. - -protected: - // These methods are called by the framework - - virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); - // This is called when asynchronous read from the socket complete - - virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); - // This is called when asynchronous writes to the file complete - -private: - int initiate_read_stream (void); - - ACE_Asynch_Read_Stream rs_; - // rs (read stream): for reading from a socket - - ACE_HANDLE dump_file_; - // File for dumping data - - ACE_Asynch_Write_File wf_; - // wf (write file): for writing to a file - - u_long file_offset_; - // Offset for the file - - ACE_HANDLE handle_; - // Handle for IO to remote peer -}; - -Receiver::Receiver (void) - : dump_file_ (ACE_INVALID_HANDLE), - handle_ (ACE_INVALID_HANDLE) -{ -} - -Receiver::~Receiver (void) -{ - ACE_OS::close (this->dump_file_); - ACE_OS::closesocket (this->handle_); -} - -void -Receiver::open (ACE_HANDLE handle, - ACE_Message_Block &message_block) -{ - // New connection, initiate stuff - - // @@ Debugging. - ACE_DEBUG ((LM_DEBUG, "%N:%l:Receiver::open called\n")); - - // Cache the new connection - this->handle_ = handle; - - // File offset starts at zero - this->file_offset_ = 0; - - // Open dump file (in OVERLAPPED mode) - this->dump_file_ = ACE_OS::open (dump_file, - O_CREAT | O_RDWR | O_TRUNC | FILE_FLAG_OVERLAPPED, - 0644); - if (this->dump_file_ == ACE_INVALID_HANDLE) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_OS::open")); - return; - } - - // Initiate ACE_Asynch_Write_File - if (this->wf_.open (*this, this->dump_file_) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::open")); - return; - } - - // Initiate ACE_Asynch_Read_Stream - if (this->rs_.open (*this, this->handle_) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::open")); - return; - } - - // Duplicate the message block so that we can keep it around - ACE_Message_Block &duplicate = *message_block.duplicate (); - - // Fake the result and make the <handle_read_stream> get - // called. But, not, if there is '0' is transferred. - if (message_block.length () != 0) - { - // Fake the result so that we will get called back. - ACE_Asynch_Read_Stream_Result_Impl *fake_result = - ACE_Proactor::instance ()->create_asynch_read_stream_result (*this, - this->handle_, - duplicate, - initial_read_size, - 0, - ACE_INVALID_HANDLE, - 0, - 0); - - size_t bytes_transferred = message_block.length (); - - // <complete> for Accept would have already moved the <wr_ptr> - // forward. Update it to the beginning position. - duplicate.wr_ptr (duplicate.wr_ptr () - bytes_transferred); - - - // This will call the callback. - fake_result->complete (message_block.length (), 1, 0); - } - else - // Otherwise, make sure we proceed. Initiate reading the - // stream. - if (this->initiate_read_stream () == -1) - return; -} - -int -Receiver::initiate_read_stream (void) -{ - // Create Message_Block - ACE_Message_Block *mb = 0; - ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); - - // Inititiate read - if (this->rs_.read (*mb, - mb->size () - 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::read"), -1); - - return 0; -} - -void -Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); - - // Reset pointers - result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); - - if (result.success () && result.bytes_transferred () != 0) - { - // Successful read: Write the data to the file. - if (this->wf_.write (result.message_block (), - result.bytes_transferred (), - this->file_offset_) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::write")); - return; - } - - // Initiate new read from the stream - if (this->initiate_read_stream () == -1) - return; - } - else - { - ACE_DEBUG ((LM_DEBUG, "Receiver completed\n")); - done = 1; - } -} - -void -Receiver::handle_write_file (const ACE_Asynch_Write_File::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_write_file called\n")); - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - - result.message_block ().release (); - - if (result.success ()) - // Write successful: Increment file offset - this->file_offset_ += result.bytes_transferred (); - - // This code is not robust enough to deal with short file writes - // (which hardly ever happen) ;-) - ACE_ASSERT (result.bytes_to_write () == result.bytes_transferred ()); -} - -class Sender : public ACE_Handler - // - // = TITLE - // - // Sender - // - // = DESCRIPTION - // - // The class will be created by main(). After connecting to the - // host, this class will then read data from a file and send it - // to the network connection. -{ -public: - Sender (void); - ~Sender (void); - int open (const char *host, - u_short port); - ACE_HANDLE handle (void) const; - -protected: - // These methods are called by the freamwork - - virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); - // This is called when asynchronous transmit files complete - virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); - // This is called when asynchronous writes from the socket complete - virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); - // This is called when asynchronous reads from the socket complete - -private: - int transmit_file (void); - - int initiate_read_file (void); - - ACE_SOCK_Stream stream_; - // Network I/O handle - - ACE_Asynch_Write_Stream ws_; - // ws (write stream): for writing to the socket - - ACE_Asynch_Read_File rf_; - // rf (read file): for writing from the file - - ACE_Asynch_Transmit_File tf_; - // Transmit file. - - ACE_HANDLE input_file_; - // File to read from - - u_long file_offset_; - // Current file offset - - u_long file_size_; - // File size - - ACE_Message_Block welcome_message_; - // Welcome message - - ACE_Asynch_Transmit_File::Header_And_Trailer header_and_trailer_; - // Header and trailer which goes with transmit_file - - int stream_write_done_; - int transmit_file_done_; - // These flags help to determine when to close down the event loop -}; - - -Sender::Sender (void) - : input_file_ (ACE_INVALID_HANDLE), - file_offset_ (0), - file_size_ (0), - stream_write_done_ (0), - transmit_file_done_ (0) -{ - // Moment of inspiration :-) - static char *data = "Welcome to Irfan World! Irfan RULES here !!\n"; - this->welcome_message_.init (data, ACE_OS::strlen (data)); - this->welcome_message_.wr_ptr (ACE_OS::strlen (data)); -} - -Sender::~Sender (void) -{ - this->stream_.close (); -} - -ACE_HANDLE -Sender::handle (void) const -{ - return this->stream_.get_handle (); -} - -int -Sender::open (const char *host, - u_short port) -{ - // Initialize stuff - - // Open input file (in OVERLAPPED mode) - this->input_file_ = ACE_OS::open (file, GENERIC_READ | FILE_FLAG_OVERLAPPED); - if (this->input_file_ == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); - - // Find file size - this->file_size_ = ACE_OS::filesize (this->input_file_); - - // Connect to remote host - ACE_INET_Addr address (port, host); - ACE_SOCK_Connector connector; - if (connector.connect (this->stream_, - address) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_SOCK_Connector::connect"), -1); - - // Open ACE_Asynch_Write_Stream - if (this->ws_.open (*this) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::open"), -1); - - // Open ACE_Asynch_Read_File - if (this->rf_.open (*this, this->input_file_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::open"), -1); - - // Start an asynchronous transmit file - if (this->transmit_file () == -1) - return -1; - - // Start an asynchronous read file - if (this->initiate_read_file () == -1) - return -1; - - return 0; -} - -int -Sender::transmit_file (void) -{ - // Open file (in SEQUENTIAL_SCAN mode) - ACE_HANDLE file_handle = ACE_OS::open (file, GENERIC_READ | FILE_FLAG_SEQUENTIAL_SCAN); - if (file_handle == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); - - // Open ACE_Asynch_Transmit_File - if (this->tf_.open (*this) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Transmit_File::open"), -1); - - // Header and trailer data for the file. - // @@ What happens if header and trailer are the same? - this->header_and_trailer_.header_and_trailer (&this->welcome_message_, - this->welcome_message_.length (), - this->welcome_message_.duplicate (), - this->welcome_message_.length ()); - - // Send it - if (this->tf_.transmit_file (file_handle, - &this->header_and_trailer_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Transmit_File::transmit_file"), -1); - - return 0; -} - -void -Sender::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_transmit_file called\n")); - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "socket", result.socket ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "file", result.file ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_per_send", result.bytes_per_send ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "flags", result.flags ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - - // Done with file - ACE_OS::close (result.file ()); - - this->transmit_file_done_ = 1; - if (this->stream_write_done_) - done = 1; -} - -int -Sender::initiate_read_file (void) -{ - // Create Message_Block - ACE_Message_Block *mb = 0; - ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); - - // Inititiate an asynchronous read from the file - if (this->rf_.read (*mb, - mb->size () - 1, - this->file_offset_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::read"), -1); - - return 0; -} - -void -Sender::handle_read_file (const ACE_Asynch_Read_File::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_read_file called\n")); - - result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - //ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); - - if (result.success ()) - { - // Read successful: increment offset and write data to network - this->file_offset_ += result.bytes_transferred (); - if (this->ws_.write (result.message_block (), - result.bytes_transferred ()) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write")); - return; - } - - if (this->file_size_ > this->file_offset_) - { - // Start an asynchronous read file - if (initiate_read_file () == -1) - return; - } - } -} - -void -Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) -{ - ACE_DEBUG ((LM_DEBUG, "handle_write_stream called\n")); - - // Reset pointers - result.message_block ().rd_ptr (result.message_block ().rd_ptr () - result.bytes_transferred ()); - - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); - ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); - ACE_DEBUG ((LM_DEBUG, "********************\n")); - ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); - - if (result.success ()) - { - // Partial write to socket - int unsent_data = result.bytes_to_write () - result.bytes_transferred (); - if (unsent_data != 0) - { - // Reset pointers - result.message_block ().rd_ptr (result.bytes_transferred ()); - - // Duplicate the message block and retry remaining data - if (this->ws_.write (*result.message_block ().duplicate (), - unsent_data) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write")); - return; - } - } - else if (!(this->file_size_ > this->file_offset_)) - { - this->stream_write_done_ = 1; - if (this->transmit_file_done_) - done = 1; - } - } - - // Release message block - result.message_block ().release (); -} - -static int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, "h:p:f:d:"); - int c; - - while ((c = get_opt ()) != EOF) - switch (c) - { - case 'h': - host = get_opt.optarg; - break; - case 'p': - port = ACE_OS::atoi (get_opt.optarg); - break; - case 'f': - file = get_opt.optarg; - break; - case 'd': - dump_file = get_opt.optarg; - break; - default: - ACE_ERROR ((LM_ERROR, "%p.\n", - "usage :\n" - "-h <host>\n" - "-p <port>\n" - "-f <file>\n")); - return -1; - } - - return 0; -} - -int -main (int argc, char *argv[]) -{ - if (parse_args (argc, argv) == -1) - return -1; - - Sender sender; - - // Note: acceptor parameterized by the Receiver - ACE_Asynch_Acceptor<Receiver> acceptor; - - // If passive side - if (host == 0) - { - if (acceptor.open (ACE_INET_Addr (port), - initial_read_size, - 1) == -1) - return -1; - } - // If active side - else if (sender.open (host, port) == -1) - return -1; - - int success = 1; - - while (success > 0 && !done) - // dispatch events - success = ACE_Proactor::instance ()->handle_events (); - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Asynch_Acceptor<Receiver>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Asynch_Acceptor<Receiver> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/ diff --git a/examples/Reactor/Proactor/test_proactor.dsp b/examples/Reactor/Proactor/test_proactor.dsp deleted file mode 100644 index 44d956c012c..00000000000 --- a/examples/Reactor/Proactor/test_proactor.dsp +++ /dev/null @@ -1,66 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_proactor" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=test_proactor - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "test_proactor.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "test_proactor.mak" CFG="test_proactor - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "test_proactor - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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
-# ADD LINK32 wsock32.lib aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "test_proactor - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\test_proactor.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Proactor/test_proactor.dsw b/examples/Reactor/Proactor/test_proactor.dsw deleted file mode 100644 index 78f457cd968..00000000000 --- a/examples/Reactor/Proactor/test_proactor.dsw +++ /dev/null @@ -1,89 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "test_cancel"=.\test_cancel.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "test_end_event_loop"=.\test_end_event_loop.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "test_multiple_loops"=.\test_multiple_loops.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "test_post_completion"=.\post_completions.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "test_proactor"=.\test_proactor.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "test_timeout"=.\test_timeout.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/Reactor/Proactor/test_timeout.cpp b/examples/Reactor/Proactor/test_timeout.cpp deleted file mode 100644 index 18884b294e0..00000000000 --- a/examples/Reactor/Proactor/test_timeout.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// $Id: test_timeout.cpp - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_timeout.cpp -// -// = DESCRIPTION -// -// This example application shows how to write event loops that -// handle events for some fixed amount of time. Note that any -// thread in the Proactor thread pool can call back the handler. On -// POSIX4 systems, this test works only with POSIX_SIG_Proactor, -// which can work with multiple threads. -// -// = AUTHOR -// Irfan Pyarali and Alexander Babu Arulanthu -// -// ============================================================================ - -#include "ace/Proactor.h" -#include "ace/Synch.h" -#include "ace/Task.h" - -ACE_RCSID(Proactor, test_timeout, "$Id$") - -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || \ - (defined (ACE_HAS_AIO_CALLS)) && !defined (ACE_POSIX_AIOCB_PROACTOR)) - // This only works on Win32 platforms and on Unix platforms supporting - // POSIX aio calls. - -class Timeout_Handler : public ACE_Handler -{ - // = TITLE - // Generic timeout handler. -public: - Timeout_Handler (void) - : start_time_ (ACE_OS::gettimeofday ()) - { - } - - virtual void handle_time_out (const ACE_Time_Value &tv, - const void *arg) - { - // Print out when timeouts occur. - ACE_DEBUG ((LM_DEBUG, "(%t) %d timeout occurred for %s @ %d.\n", - ++count_, - (char *) arg, - (tv - this->start_time_).sec ())); - - // Sleep for a while - ACE_OS::sleep (4); - } - -private: - ACE_Atomic_Op <ACE_Thread_Mutex, int> count_; - // Number of the timer event. - - ACE_Time_Value start_time_; - // Starting time of the test. -}; - -class Worker : public ACE_Task <ACE_NULL_SYNCH> -{ -public: - int svc (void) - { - // Handle events for 13 seconds. - ACE_Time_Value run_time (13); - - ACE_DEBUG ((LM_DEBUG, "(%t):Starting svc routine\n")); - - if (ACE_Proactor::run_event_loop(run_time) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t):%p.\n", "Worker::svc"), -1); - - ACE_DEBUG ((LM_DEBUG, "(%t) work complete\n")); - - return 0; - } -}; - -int -main (int, char *[]) -{ - Timeout_Handler handler; - - // Register a 2 second timer. - ACE_Time_Value foo_tv (2); - if (ACE_Proactor::instance ()->schedule_timer (handler, - (void *) "Foo", - ACE_Time_Value::zero, - foo_tv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - - // Register a 3 second timer. - ACE_Time_Value bar_tv (3); - if (ACE_Proactor::instance ()->schedule_timer (handler, - (void *) "Bar", - ACE_Time_Value::zero, - bar_tv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - - Worker worker; - - if (worker.activate (THR_NEW_LWP, 10) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); - - ACE_Thread_Manager::instance ()->wait (); - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#else /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ - -int -main (int, char *[]) -{ - ACE_DEBUG ((LM_DEBUG, - "This example is multithreaded version of test_timeout_st.cpp\n" - "This doesnt work on this platform !!!\n")); - return 1; -} - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ diff --git a/examples/Reactor/Proactor/test_timeout.dsp b/examples/Reactor/Proactor/test_timeout.dsp deleted file mode 100644 index 9d2341b000b..00000000000 --- a/examples/Reactor/Proactor/test_timeout.dsp +++ /dev/null @@ -1,70 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_timeout" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=test_timeout - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "test_timeout.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "test_timeout.mak" CFG="test_timeout - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "test_timeout - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\test_timeout\Debug"
-# PROP BASE Intermediate_Dir ".\test_timeout\Debug"
-# PROP BASE Target_Dir ".\test_timeout"
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ".\test_timeout"
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "test_timeout - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\test_timeout.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/Reactor/Proactor/test_timeout_st.cpp b/examples/Reactor/Proactor/test_timeout_st.cpp deleted file mode 100644 index cf8372b6c37..00000000000 --- a/examples/Reactor/Proactor/test_timeout_st.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_timeout_st.cpp -// -// = DESCRIPTION -// -// This example application shows how to write event loops that -// handle events for some fixed amount of time. This is the single -// threaded version of the test_timeout.cpp application. -// -// = AUTHOR -// Irfan Pyarali and Alexander Babu Arulanthu -// -// ============================================================================ - -#include "ace/Proactor.h" - -ACE_RCSID(Proactor, test_timeout, "$Id$") - -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) -// This only works on Win32 platforms and on Unix platforms supporting -// POSIX aio calls. - -class Timeout_Handler : public ACE_Handler -{ - // = TITLE - // Generic timeout handler. - -public: - Timeout_Handler (void) - : count_ (0), - start_time_ (ACE_OS::gettimeofday ()) - { - } - - virtual void handle_time_out (const ACE_Time_Value &tv, - const void *arg) - { - // Print out when timeouts occur. - ACE_DEBUG ((LM_DEBUG, "(%t) %d timeout occurred for %s @ %d.\n", - ++count_, - (char *) arg, - (tv - this->start_time_).sec ())); - } - -private: - int count_; - // Sequence number for the timeouts. - - ACE_Time_Value start_time_; - // Starting time of the test. -}; - - -int -main (int, char *[]) -{ - Timeout_Handler handler; - - // Register a 2 second timer. - ACE_Time_Value foo_tv (2); - if (ACE_Proactor::instance ()->schedule_timer (handler, - (void *) "Foo", - ACE_Time_Value::zero, - foo_tv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - - // Register a 3 second timer. - ACE_Time_Value bar_tv (3); - if (ACE_Proactor::instance ()->schedule_timer (handler, - (void *) "Bar", - ACE_Time_Value::zero, - bar_tv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - - // Handle events for 13 seconds. - ACE_Time_Value run_time (13); - - ACE_DEBUG ((LM_DEBUG, "Starting event loop\n")); - - // Run the event loop. - if (ACE_Proactor::run_event_loop(run_time) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%t):%p.\n", "Worker::svc"), - 1); - - ACE_DEBUG ((LM_DEBUG, "Ending event loop\n")); - - return 0; -} - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/ diff --git a/examples/Reactor/README b/examples/Reactor/README deleted file mode 100644 index fefaeeaf317..00000000000 --- a/examples/Reactor/README +++ /dev/null @@ -1,20 +0,0 @@ -This directory contains subdirectories that test the ACE Reactor and Proactor - - . Dgram - Tests the CODgram and Dgram classes with the Reactor. - - . Misc - Various miscellaneous tests of Reactor functionality - (e.g., signals, timers, notification, etc.). - - . Multicast - Tests out the ACE multicast capabilities in conjunction - with the Reactor. - - . Ntalker - A program that implements a multicast "chat" program. - - - . Proactor - A program that illustrates the "Proactive" version of - the Reactor diff --git a/examples/Reactor/WFMO_Reactor/APC.DSP b/examples/Reactor/WFMO_Reactor/APC.DSP deleted file mode 100644 index 29b2fcce4f9..00000000000 --- a/examples/Reactor/WFMO_Reactor/APC.DSP +++ /dev/null @@ -1,58 +0,0 @@ -# Microsoft Developer Studio Project File - Name="APC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=APC - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Apc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Apc.mak" CFG="APC - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "APC - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "APC___Wi" -# PROP BASE Intermediate_Dir "APC___Wi" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# 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 /libpath:"..\..\..\ace" -# Begin Target - -# Name "APC - Win32 Debug" -# Begin Source File - -SOURCE=.\test_apc.cpp -# End Source File -# End Target -# End Project diff --git a/examples/Reactor/WFMO_Reactor/Abondoned.dsp b/examples/Reactor/WFMO_Reactor/Abondoned.dsp deleted file mode 100644 index d113db90ba6..00000000000 --- a/examples/Reactor/WFMO_Reactor/Abondoned.dsp +++ /dev/null @@ -1,58 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Abondoned" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Abondoned - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Abondoned.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Abondoned.mak" CFG="Abondoned - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Abondoned - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Abondone"
-# PROP BASE Intermediate_Dir "Abondone"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Abondoned - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_abandoned.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Console_Input.dsp b/examples/Reactor/WFMO_Reactor/Console_Input.dsp deleted file mode 100644 index b5f5b870dde..00000000000 --- a/examples/Reactor/WFMO_Reactor/Console_Input.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Console_Input" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Console_Input - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Console_Input.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Console_Input.mak" CFG="Console_Input - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Console_Input - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Console_"
-# PROP BASE Intermediate_Dir "Console_"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Console_Input - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_console_input.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Directory_Changes.dsp b/examples/Reactor/WFMO_Reactor/Directory_Changes.dsp deleted file mode 100644 index cea930eac62..00000000000 --- a/examples/Reactor/WFMO_Reactor/Directory_Changes.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Directory_Changes" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Directory_Changes - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Directory_Changes.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Directory_Changes.mak" CFG="Directory_Changes - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Directory_Changes - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Director"
-# PROP BASE Intermediate_Dir "Director"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Directory_Changes - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_directory_changes.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Exceptions.dsp b/examples/Reactor/WFMO_Reactor/Exceptions.dsp deleted file mode 100644 index 51a8324d72f..00000000000 --- a/examples/Reactor/WFMO_Reactor/Exceptions.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Exceptions" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Exceptions - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Exceptions.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Exceptions.mak" CFG="Exceptions - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Exceptions - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Exceptio"
-# PROP BASE Intermediate_Dir "Exceptio"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Exceptions - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_exceptions.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Handle_Close.dsp b/examples/Reactor/WFMO_Reactor/Handle_Close.dsp deleted file mode 100644 index 4045f734c40..00000000000 --- a/examples/Reactor/WFMO_Reactor/Handle_Close.dsp +++ /dev/null @@ -1,58 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Handle_Close" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Handle_Close - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Handle_Close.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Handle_Close.mak" CFG="Handle_Close - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Handle_Close - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Handle_C"
-# PROP BASE Intermediate_Dir "Handle_C"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Handle_Close - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_handle_close.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Multithreading.dsp b/examples/Reactor/WFMO_Reactor/Multithreading.dsp deleted file mode 100644 index 378d7483ca7..00000000000 --- a/examples/Reactor/WFMO_Reactor/Multithreading.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Multithreading" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Multithreading - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Multithreading.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Multithreading.mak" CFG="Multithreading - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Multithreading - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Multithr"
-# PROP BASE Intermediate_Dir "Multithr"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Multithreading - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_multithreading.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Network_Events.dsp b/examples/Reactor/WFMO_Reactor/Network_Events.dsp deleted file mode 100644 index be0d021963e..00000000000 --- a/examples/Reactor/WFMO_Reactor/Network_Events.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Network_Events" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Network_Events - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Network_Events.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Network_Events.mak" CFG="Network_Events - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Network_Events - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Network_"
-# PROP BASE Intermediate_Dir "Network_"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Network_Events - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_network_events.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Prerun_State_Changes.dsp b/examples/Reactor/WFMO_Reactor/Prerun_State_Changes.dsp deleted file mode 100644 index c8d344a9966..00000000000 --- a/examples/Reactor/WFMO_Reactor/Prerun_State_Changes.dsp +++ /dev/null @@ -1,60 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Prerun_State_Changes" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Prerun_State_Changes - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Prerun_State_Changes.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Prerun_State_Changes.mak"\
- CFG="Prerun_State_Changes - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Prerun_State_Changes - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Prerun_S"
-# PROP BASE Intermediate_Dir "Prerun_S"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Prerun_State_Changes - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_prerun_state_changes.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Registration.dsp b/examples/Reactor/WFMO_Reactor/Registration.dsp deleted file mode 100644 index c716a2a552c..00000000000 --- a/examples/Reactor/WFMO_Reactor/Registration.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Registration" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Registration - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Registration.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Registration.mak" CFG="Registration - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Registration - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Registra"
-# PROP BASE Intermediate_Dir "Registra"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Registration - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_registration.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Registry_Changes.dsp b/examples/Reactor/WFMO_Reactor/Registry_Changes.dsp deleted file mode 100644 index 6effdcc5759..00000000000 --- a/examples/Reactor/WFMO_Reactor/Registry_Changes.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Registry_Changes" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Registry_Changes - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Registry_Changes.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Registry_Changes.mak" CFG="Registry_Changes - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Registry_Changes - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Registry"
-# PROP BASE Intermediate_Dir "Registry"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Registry_Changes - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_registry_changes.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Removals.dsp b/examples/Reactor/WFMO_Reactor/Removals.dsp deleted file mode 100644 index f888c8dc336..00000000000 --- a/examples/Reactor/WFMO_Reactor/Removals.dsp +++ /dev/null @@ -1,58 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Removals" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Removals - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Removals.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Removals.mak" CFG="Removals - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Removals - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Removal0"
-# PROP BASE Intermediate_Dir "Removal0"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Removals - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_removals.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Talker.dsp b/examples/Reactor/WFMO_Reactor/Talker.dsp deleted file mode 100644 index 500af90cee6..00000000000 --- a/examples/Reactor/WFMO_Reactor/Talker.dsp +++ /dev/null @@ -1,58 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Talker" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Talker - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Talker.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Talker.mak" CFG="Talker - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Talker - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Talker__"
-# PROP BASE Intermediate_Dir "Talker__"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Talker - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_talker.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/Timeouts.dsp b/examples/Reactor/WFMO_Reactor/Timeouts.dsp deleted file mode 100644 index 764458116ab..00000000000 --- a/examples/Reactor/WFMO_Reactor/Timeouts.dsp +++ /dev/null @@ -1,58 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Timeouts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Timeouts - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Timeouts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Timeouts.mak" CFG="Timeouts - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Timeouts - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Timeout0"
-# PROP BASE Intermediate_Dir "Timeout0"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Timeouts - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_timeouts.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/WFMO_Reactor.dsw b/examples/Reactor/WFMO_Reactor/WFMO_Reactor.dsw deleted file mode 100644 index 81f8e0d8760..00000000000 --- a/examples/Reactor/WFMO_Reactor/WFMO_Reactor.dsw +++ /dev/null @@ -1,197 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "APC"=.\Apc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Abondoned"=.\Abondoned.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Console_Input"=.\Console_Input.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Directory_Changes"=.\Directory_Changes.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Exceptions"=.\Exceptions.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Handle_Close"=.\Handle_Close.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Multithreading"=.\Multithreading.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Network_Events"=.\Network_Events.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-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>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Registry_Changes"=.\Registry_Changes.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Removals"=.\Removals.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Talker"=.\Talker.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Timeouts"=.\Timeouts.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Window_Messages"=.\Window_Messages.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/Reactor/WFMO_Reactor/Window_Messages.dsp b/examples/Reactor/WFMO_Reactor/Window_Messages.dsp deleted file mode 100644 index 5be34bd2132..00000000000 --- a/examples/Reactor/WFMO_Reactor/Window_Messages.dsp +++ /dev/null @@ -1,59 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Window_Messages" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Window_Messages - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Window_Messages.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Window_Messages.mak" CFG="Window_Messages - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Window_Messages - Win32 Debug" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Window_M"
-# PROP BASE Intermediate_Dir "Window_M"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# 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 user32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
-# Begin Target
-
-# Name "Window_Messages - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\test_window_messages.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/examples/Reactor/WFMO_Reactor/test_abandoned.cpp b/examples/Reactor/WFMO_Reactor/test_abandoned.cpp deleted file mode 100644 index 3c6c8c33d8d..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_abandoned.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_abandoned.cpp -// -// = DESCRIPTION -// -// Tests the WFMO_Reactor's ability to handle abandoned mutexes. -// -// = AUTHOR -// -// Irfan Pyarali <irfan@cs.wustl.edu> -// -// ============================================================================ - -#include "ace/Reactor.h" -#include "ace/Synch.h" -#include "ace/Thread_Manager.h" - -ACE_RCSID(ReactorEx, test_abandoned, "$Id$") - -class Event_Handler : public ACE_Event_Handler -{ -public: - int handle_signal (int signum, - siginfo_t * = 0, - ucontext_t * = 0); - - int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - - ACE_Auto_Event handle_; - ACE_Process_Mutex *mutex_; - int iterations_; -}; - -static int abandon = 1; - -static void * -worker (void *data) -{ - Event_Handler *handler = (Event_Handler *) data; - - handler->handle_.signal (); - handler->mutex_->acquire (); - - if (!abandon) - handler->mutex_->release (); - - return 0; -} - -int -Event_Handler::handle_signal (int signum, - siginfo_t *s, - ucontext_t *) -{ - HANDLE handle = s->si_handle_; - if (handle == this->handle_.handle ()) - ACE_Reactor::instance ()->register_handler (this, - this->mutex_->lock ().proc_mutex_); - else - { - ACE_Reactor::instance ()->remove_handler (this->mutex_->lock ().proc_mutex_, - ACE_Event_Handler::DONT_CALL); - delete this->mutex_; - } - - return 0; -} - -int -Event_Handler::handle_timeout (const ACE_Time_Value &tv, - const void *arg) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) timeout occured @ %T, iterations left %d\n", - --this->iterations_)); - - if (this->iterations_ == 0) - ACE_Reactor::end_event_loop (); - else - { - ACE_NEW_RETURN (this->mutex_, - ACE_Process_Mutex, - -1); - ACE_ASSERT (ACE_Thread_Manager::instance ()->spawn - (&worker, - this) != -1); - } - - return 0; -} - -Event_Handler event_handler; - -int -main (int argc, char *argv[]) -{ - event_handler.iterations_ = 5; - int result = ACE_Reactor::instance ()->register_handler - (&event_handler, - event_handler.handle_.handle (); - ACE_ASSERT (result == 0); - - ACE_Time_Value timeout (2); - result = ACE_Reactor::instance ()->schedule_timer (&event_handler, - 0, - timeout, - timeout); - ACE_ASSERT (result != -1); - - ACE_Reactor::run_event_loop (); - - return 0; -} - diff --git a/examples/Reactor/WFMO_Reactor/test_apc.cpp b/examples/Reactor/WFMO_Reactor/test_apc.cpp deleted file mode 100644 index a618396ec51..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_apc.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_apc.cpp -// -// = DESCRIPTION -// -// Tests the WFMO_Reactor's ability to handle regular APC -// notifications. -// -// = AUTHOR -// -// Irfan Pyarali <irfan@cs.wustl.edu> -// -// ============================================================================ - -#include "ace/Reactor.h" - -ACE_RCSID(ReactorEx, test_apc, "$Id$") - -class Event_Handler : public ACE_Event_Handler -{ -public: - int handle_signal (int signum, - siginfo_t * = 0, - ucontext_t * = 0); - - int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - - ACE_Auto_Event handle_; - int iterations_; -}; - -static Event_Handler event_handler; - -static void WINAPI -apc_callback (DWORD) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) apc occured @ %T\n")); - - event_handler.handle_.signal (); -} - -void -queue_apc (void) -{ - DWORD result = ::QueueUserAPC (&apc_callback, // pointer to APC function - ::GetCurrentThread (), // handle to the thread - 0); // argument for the APC function - if (result == FALSE) - ACE_OS::exit (-1); -} - -int -Event_Handler::handle_signal (int signum, - siginfo_t *, - ucontext_t *) -{ - --this->iterations_; - - if (this->iterations_ == 0) - ACE_Reactor::end_event_loop (); - - return 0; -} - -int -Event_Handler::handle_timeout (const ACE_Time_Value &tv, - const void *arg) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) timeout occured @ %T\n")); - queue_apc (); - return 0; -} - -int -main (int argc, char *argv[]) -{ - event_handler.iterations_ = 5; - int result = ACE_Reactor::instance ()->register_handler (&event_handler, - event_handler.handle_.handle (); - ACE_ASSERT (result == 0); - - ACE_Time_Value timeout (2); - result = ACE_Reactor::instance ()->schedule_timer (&event_handler, - 0, - timeout, - timeout); - ACE_ASSERT (result != -1); - - ACE_Reactor::run_alertable_event_loop (); - - return 0; -} - diff --git a/examples/Reactor/WFMO_Reactor/test_console_input.cpp b/examples/Reactor/WFMO_Reactor/test_console_input.cpp deleted file mode 100644 index 75168bde9ee..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_console_input.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_console_input.cpp -// -// = DESCRIPTION -// -// This application tests the working of WFMO_Reactor when users -// are interested in console input. -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" - -ACE_RCSID(ReactorEx, test_console_input, "$Id$") - -class Event_Handler : public ACE_Event_Handler -{ -public: - Event_Handler (ACE_Reactor &reactor); - int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); -}; - -Event_Handler::Event_Handler (ACE_Reactor &reactor) -{ - this->reactor (&reactor); - - if (this->reactor ()->register_handler (this, - ACE_STDIN) != 0) - ACE_ERROR ((LM_ERROR, - "Registration with Reactor could not be done\n")); -} - -int -Event_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - TCHAR buffer[BUFSIZ]; - int result = ACE_OS::read (ACE_STDIN, buffer, sizeof buffer); - buffer[result] = '\0'; - - if (result <= 0) - { - this->reactor ()->close (); - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::read"), -1); - } - - if (ACE_OS::strcmp (ACE_TEXT("quit\r\n"), buffer) == 0) - this->reactor ()->close (); - - ACE_DEBUG ((LM_DEBUG, "User input: %s", buffer)); - - return 0; -} - -int -Event_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_DEBUG ((LM_DEBUG, "Event_Handler removed from Reactor\n")); - return 0; -} - -int -main (int, char *[]) -{ - ACE_Reactor reactor; - Event_Handler handler (reactor); - - int result = 0; - while (result != -1) - result = reactor.handle_events (); - - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_directory_changes.cpp b/examples/Reactor/WFMO_Reactor/test_directory_changes.cpp deleted file mode 100644 index 763f5d492fb..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_directory_changes.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_directory_changes.cpp -// -// = DESCRIPTION -// -// This application tests the working of WFMO_Reactor when users -// are interested in monitoring changes in the filesystem. -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" - -ACE_RCSID(ReactorEx, test_directory_changes, "$Id$") - -static int stop_test = 0; -static LPCTSTR directory = ACE_TEXT ("."); -static LPCTSTR temp_file = ACE_TEXT ("foo"); - -class Event_Handler : public ACE_Event_Handler -{ -public: - Event_Handler (ACE_Reactor &reactor); - ~Event_Handler (void); - int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - -private: - ACE_HANDLE handle_; -}; - -Event_Handler::Event_Handler (ACE_Reactor &reactor) - : handle_ (ACE_INVALID_HANDLE) -{ - this->reactor (&reactor); - - int change_notification_flags = FILE_NOTIFY_CHANGE_FILE_NAME; - - this->handle_ = ::FindFirstChangeNotification (directory, // pointer to name of directory to watch - FALSE, // flag for monitoring directory or directory tree - change_notification_flags // filter conditions to watch for - ); - if (this->handle_ == ACE_INVALID_HANDLE) - ACE_ERROR ((LM_ERROR, "FindFirstChangeNotification could not be setup\n")); - - if (this->reactor ()->register_handler (this, - this->handle_) != 0) - ACE_ERROR ((LM_ERROR, "Registration with Reactor could not be done\n")); -} - -Event_Handler::~Event_Handler (void) -{ -} - -int -Event_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - ::FindNextChangeNotification (this->handle_); - if (stop_test) - this->reactor ()->close (); - return 0; -} - -int -Event_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_DEBUG ((LM_DEBUG, "Event_Handler removed from Reactor\n")); - ::FindCloseChangeNotification (this->handle_); - return 0; -} - -void -worker (void) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) Thread creation\n")); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread creating temporary file\n")); - ACE_HANDLE file = ACE_OS::open (temp_file, _O_CREAT | _O_EXCL); - if (file == ACE_INVALID_HANDLE) - ACE_ERROR ((LM_ERROR, "Error in creating %s: %p\n", temp_file, "ACE_OS::open")); - else - { - ACE_OS::close (file); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread sleeping\n")); - ACE_OS::sleep (3); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread removing temporary file\n")); - stop_test = 1; - ACE_OS::unlink (temp_file); - } -} - -int -main (int, char *[]) -{ - ACE_Reactor reactor; - Event_Handler handler (reactor); - - ACE_ASSERT (ACE_OS::thr_create ((ACE_THR_FUNC) worker, 0, 0, 0) == 0); - - int result = 0; - while (result != -1) - result = reactor.handle_events (); - - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_exceptions.cpp b/examples/Reactor/WFMO_Reactor/test_exceptions.cpp deleted file mode 100644 index 5ab6d00cb4e..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_exceptions.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_exceptions.cpp -// -// = DESCRIPTION -// -// This test application tests the state of WFMO_Reactor when -// exceptions occurs when executing user callbacks. -// -// The thread count in WFMO_Reactor is used to ensure that state of -// WFMO_Reactor is not fouled up when exceptions occur in user code. -// This example also shows how to write event loops that survive -// user exceptions -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/WFMO_Reactor.h" - -ACE_RCSID(ReactorEx, test_exceptions, "$Id$") - -class Event_Handler : public ACE_Event_Handler -{ -public: - Event_Handler (void) - : event_ (1) - { - ACE_DEBUG ((LM_DEBUG, - "Event_Handler created\n")); - } - - ~Event_Handler (void) - { - ACE_DEBUG ((LM_DEBUG, - "Event_Handler destroyed\n")); - } - - int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0) - { - char *cause_exception = 0; - char a = *cause_exception; - return 0; - } - - ACE_HANDLE get_handle (void) const - { - return this->event_.handle (); - } -private: - ACE_Manual_Event event_; -}; - -class ACE_WFMO_Reactor_Test -{ -public: - static void doit (ACE_WFMO_Reactor &wfmo_reactor) - { - for (int i = 1; i <= 10; i++) - { - ACE_DEBUG ((LM_DEBUG, - "Active threads in WFMO_Reactor (before handle_events) = %d\n", - wfmo_reactor.active_threads_)); - ACE_SEH_TRY - { - wfmo_reactor.handle_events (); - } - ACE_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) - { - ACE_DEBUG ((LM_DEBUG, - "Exception occurred\n")); - } - ACE_DEBUG ((LM_DEBUG, - "Active threads in WFMO_Reactor (after handle_events) = %d\n", - wfmo_reactor.active_threads_)); - } - } -}; - -int -main (int, char *[]) -{ - Event_Handler handler; - ACE_WFMO_Reactor wfmo_reactor; - wfmo_reactor.register_handler (&handler); - - ACE_WFMO_Reactor_Test::doit (wfmo_reactor); - - return 0; -} - diff --git a/examples/Reactor/WFMO_Reactor/test_handle_close.cpp b/examples/Reactor/WFMO_Reactor/test_handle_close.cpp deleted file mode 100644 index 71f57d2c63e..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_handle_close.cpp +++ /dev/null @@ -1,300 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_handle_close.cpp -// -// = DESCRIPTION -// -// This application tests whether handle_close gets called and if -// the correct masks are passed along. The handler should get -// handle_close called for all three masks (READ, WRITE, and -// EXCEPT). -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Get_Opt.h" -#include "ace/Reactor.h" -#include "ace/WFMO_Reactor.h" -#include "ace/Select_Reactor.h" -#include "ace/Auto_Ptr.h" -#include "ace/Pipe.h" - -ACE_RCSID(WFMO_Reactor, test_handle_close, "$Id$") - -// Use the WFMO_Reactor -static int opt_wfmo_reactor = 0; - -// Use the Select_Reactor -static int opt_select_reactor = 0; - -// Make pipe readable in main() -static int write_to_pipe_in_main = 0; - -// Cancel reads -static int cancel_reads = 0; - -// Write some data to the pipe. This will cause handle_input to get -// called. -void -write_to_pipe (ACE_Pipe &pipe) -{ - char *data = "hello"; - int len = ACE_OS::strlen (data); - - int result = ACE::send (pipe.write_handle (), - data, - len); - ACE_ASSERT (result == len); -} - -// Simple handler class -class Handler : public ACE_Event_Handler -{ -public: - Handler (ACE_Pipe &pipe) - : pipe_ (pipe) - { - } - - ACE_HANDLE get_handle (void) const - { - return this->pipe_.read_handle (); - } - - int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) - { - ACE_DEBUG ((LM_DEBUG, - "Handler::handle_close called with mask = %d\n", - close_mask)); - return 0; - } - - int handle_input (ACE_HANDLE handle) - { - ACE_DEBUG ((LM_DEBUG, "Handler::handle_input\n")); - - // Remove for reading - return -1; - } - - int handle_output (ACE_HANDLE handle) - { - ACE_DEBUG ((LM_DEBUG, "Handler::handle_output\n")); - - // Optionally cancel reads - if (cancel_reads) - { - int result = ACE_Reactor::instance ()->cancel_wakeup (this, - ACE_Event_Handler::READ_MASK); - ACE_ASSERT (result != -1); - } - - // Write to the pipe; this causes handle_input to get called. - if (!write_to_pipe_in_main) - write_to_pipe (this->pipe_); - - // Remove for writing - return -1; - } - -protected: - ACE_Pipe &pipe_; -}; - -class Different_Handler : public ACE_Event_Handler -{ -public: - - Different_Handler (ACE_Pipe &pipe) - : pipe_ (pipe) - { - } - - ACE_HANDLE get_handle (void) const - { - return this->pipe_.read_handle (); - } - - int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) - { - ACE_DEBUG ((LM_DEBUG, - "Different_Handler::handle_close called with mask = %d\n", - close_mask)); - return 0; - } - - int handle_input (ACE_HANDLE handle) - { - ACE_DEBUG ((LM_DEBUG, "Different_Handler::handle_input\n")); - - // Remove for reading - int result = ACE_Reactor::instance ()->remove_handler (this, - ACE_Event_Handler::READ_MASK); - ACE_ASSERT (result == 0); - - return 0; - } - - int handle_output (ACE_HANDLE handle) - { - ACE_DEBUG ((LM_DEBUG, "Different_Handler::handle_output\n")); - - // Add for reading - int result = ACE_Reactor::instance ()->mask_ops (this, - ACE_Event_Handler::READ_MASK, - ACE_Reactor::ADD_MASK); - ACE_Reactor_Mask old_masks = - ACE_Event_Handler::WRITE_MASK | - ACE_Event_Handler::EXCEPT_MASK; - - ACE_ASSERT (result == old_masks); - - // Get new masks - result = ACE_Reactor::instance ()->mask_ops (this, - ACE_Event_Handler::NULL_MASK, - ACE_Reactor::GET_MASK); - ACE_Reactor_Mask current_masks = - ACE_Event_Handler::READ_MASK | - ACE_Event_Handler::WRITE_MASK | - ACE_Event_Handler::EXCEPT_MASK; - - ACE_ASSERT (result == current_masks); - - // Remove for writing - ACE_Reactor_Mask mask = ACE_Event_Handler::WRITE_MASK | ACE_Event_Handler::DONT_CALL; - result = ACE_Reactor::instance ()->remove_handler (this, - mask); - ACE_ASSERT (result == 0); - - // Write to the pipe; this causes handle_input to get called. - if (!write_to_pipe_in_main) - write_to_pipe (this->pipe_); - - return 0; - } - -protected: - ACE_Pipe &pipe_; -}; - - -// -// Selection of which reactor should get created -// -void -create_reactor (void) -{ - ACE_Reactor_Impl *impl = 0; - - if (opt_wfmo_reactor) - { -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) - ACE_NEW (impl, - ACE_WFMO_Reactor); -#endif /* ACE_WIN32 */ - } - else if (opt_select_reactor) - ACE_NEW (impl, - ACE_Select_Reactor); - - ACE_Reactor *reactor = 0; - ACE_NEW (reactor, - ACE_Reactor (impl)); - ACE_Reactor::instance (reactor); -} - -int -main (int argc, char *argv[]) -{ - int result = 0; - - // Parse args - ACE_Get_Opt getopt (argc, argv, ASYS_TEXT ("swmc"), 1); - for (int c; (c = getopt ()) != -1; ) - switch (c) - { - case 's': - opt_select_reactor = 1; - break; - case 'w': - opt_wfmo_reactor = 1; - break; - case 'm': - write_to_pipe_in_main = 1; - break; - case 'c': - cancel_reads = 1; - break; - } - - // Create pipes - ACE_Pipe pipe1, pipe2; - - result = pipe1.open (); - ACE_ASSERT (result == 0); - - result = pipe2.open (); - ACE_ASSERT (result == 0); - - // Create handlers - Handler handler (pipe1); - Different_Handler different_handler (pipe2); - - // Create reactor - create_reactor (); - - // Manage memory automagically. - auto_ptr<ACE_Reactor> reactor (ACE_Reactor::instance ()); - auto_ptr<ACE_Reactor_Impl> impl; - - // If we are using other that the default implementation, we must - // clean up. - if (opt_select_reactor || opt_wfmo_reactor) - impl = auto_ptr<ACE_Reactor_Impl> (ACE_Reactor::instance ()->implementation ()); - - // Register handlers - ACE_Reactor_Mask handler_mask = - ACE_Event_Handler::READ_MASK | - ACE_Event_Handler::WRITE_MASK | - ACE_Event_Handler::EXCEPT_MASK; - - ACE_Reactor_Mask different_handler_mask = - ACE_Event_Handler::WRITE_MASK | - ACE_Event_Handler::EXCEPT_MASK; - - result = ACE_Reactor::instance ()->register_handler (&handler, - handler_mask); - ACE_ASSERT (result == 0); - - result = ACE_Reactor::instance ()->register_handler (&different_handler, - different_handler_mask); - ACE_ASSERT (result == 0); - - // Write to the pipe; this causes handle_input to get called. - if (write_to_pipe_in_main) - { - write_to_pipe (pipe1); - write_to_pipe (pipe2); - } - - // Note that handle_output will get called automatically since the - // pipe is writable! - - // Run for three seconds - ACE_Time_Value time (3); - ACE_Reactor::instance ()->run_event_loop (time); - - ACE_DEBUG ((LM_DEBUG, "\nClosing down the application\n\n")); - - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_multithreading.cpp b/examples/Reactor/WFMO_Reactor/test_multithreading.cpp deleted file mode 100644 index 8e59adffe5b..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_multithreading.cpp +++ /dev/null @@ -1,246 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_multithreading.cpp -// -// = DESCRIPTION -// -// This application tests multiple threads simultaneously calling -// Reactor::handle_events(). It also shows how different threads -// can update the state of Reactor by registering and removing -// Event_Handlers. -// -// Note that this test will only work with WFMO_Reactor -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Task.h" -#include "ace/Reactor.h" -#include "ace/WFMO_Reactor.h" -#include "ace/Get_Opt.h" - -ACE_RCSID(ReactorEx, test_multithreading, "$Id$") - -static int concurrent_threads = 1; -static int number_of_handles = ACE_Reactor::instance ()->size (); -static int number_of_handles_to_signal = 1; -static int interval = 2; -static int iterations = 10; - -// Explain usage and exit. -static void -print_usage_and_die (void) -{ - ACE_DEBUG ((LM_DEBUG, - "usage: \n\t" - "[-t (# of threads - default 1)] \n\t" - "[-h (# of handlers) - default 62] \n\t" - "[-i (# time interval between signals) - default 2] \n\t" - "[-s (# of handles to signal) - default 1] \n\t" - "[-e (# of iterations) - default 10] \n\t")); - ACE_OS::exit (1); -} - -// Parse the command-line arguments and set options. -static void -parse_args (int argc, char **argv) -{ - ACE_Get_Opt get_opt (argc, argv, "t:h:s:i:e:"); - int c; - - while ((c = get_opt ()) != -1) - switch (c) - { - case 't': - concurrent_threads = atoi (get_opt.optarg); - break; - case 'e': - iterations = atoi (get_opt.optarg); - break; - case 'h': - number_of_handles = atoi (get_opt.optarg); - break; - case 'i': - interval = atoi (get_opt.optarg); - break; - case 's': - number_of_handles_to_signal = atoi (get_opt.optarg); - break; - default: - print_usage_and_die (); - break; - } -} - -class Task_Handler : public ACE_Task<ACE_NULL_SYNCH> -{ -public: - Task_Handler (size_t number_of_handles, - size_t concurrent_threads); - // Constructor. - - ~Task_Handler (void); - // Destructor. - - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - // Called when object is removed from the ACE_Reactor - - int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - // Handle events being signaled by the main thread. - - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - // Called when timer expires. - - int svc (void); - // Task event loop. - - int signal (size_t index); - // Signal an event. - -private: - ACE_Auto_Event *events_; -}; - -// All threads do reactor->handle_events () -int -Task_Handler::svc (void) -{ - // Try to become the owner - ACE_Reactor::instance ()->owner (ACE_Thread::self ()); - // Run the event loop. - return ACE_Reactor::run_event_loop (); -} - -Task_Handler::Task_Handler (size_t number_of_handles, - size_t concurrent_threads) -{ - ACE_NEW (this->events_, ACE_Auto_Event [number_of_handles]); - - for (size_t i = 1; i <= number_of_handles; i++) - if (ACE_Reactor::instance ()->register_handler (this, - this->events_[i].handle ()) == -1) - ACE_ERROR ((LM_ERROR, - "%p\t cannot register handle %d with Reactor\n", - "Task_Handler::Task_Handler", - i)); - - // Make us an active object. - if (this->activate (THR_NEW_LWP, - concurrent_threads) == -1) - ACE_ERROR ((LM_ERROR, "%p\t cannot activate task\n", - "activate")); -} - -Task_Handler::~Task_Handler (void) -{ - delete [] this->events_; -} - - -int -Task_Handler::handle_signal (int signum, siginfo_t *siginfo, ucontext_t *) -{ - // When signaled, print message, remove self, and add self - // This will force Reactor to update its internal handle tables - - if (ACE_Reactor::instance ()->remove_handler (siginfo->si_handle_, - ACE_Event_Handler::DONT_CALL) == -1) - return -1; - // ACE_ERROR_RETURN ((LM_ERROR, - // "(%t) %p\tTask cannot be unregistered from Reactor: handle value = %d\n", - // "Task_Handler::handle_signal", - // siginfo->si_handle_), -1); - - if (ACE_Reactor::instance ()->register_handler (this, - siginfo->si_handle_) == -1) - return -1; - // ACE_ERROR_RETURN ((LM_ERROR, - // "(%t) %p\tTask cannot be registered with Reactor: handle value = %d\n", - // "Task_Handler::handle_signal", - // siginfo->si_handle_), -1); - return 0; -} - -int -Task_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) handle_close() called: handle value = %d\n", - handle)); - return 0; -} - -int -Task_Handler::handle_timeout (const ACE_Time_Value &tv, - const void *arg) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) handle_timeout() called: iteration value = %d\n", - int (arg))); - return 0; -} - -int -Task_Handler::signal (size_t index) -{ - return this->events_[index].signal (); -} - -int -main (int argc, char **argv) -{ - parse_args (argc, argv); - Task_Handler task (number_of_handles, - concurrent_threads); - - ACE_OS::srand (ACE_OS::time (0L)); - - for (int i = 1; i <= iterations; i++) - { - // Sleep for a while - ACE_OS::sleep (interval); - - // Randomly generate events - ACE_DEBUG ((LM_DEBUG, "********************************************************\n")); - ACE_DEBUG ((LM_DEBUG, "(%t -- main thread) signaling %d events : iteration = %d\n", - number_of_handles_to_signal, - i)); - ACE_DEBUG ((LM_DEBUG, "********************************************************\n")); - - // Setup a timer for the task - if (ACE_Reactor::instance ()->schedule_timer (&task, - (void *) i, - 0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); - - for (int i = 0; i < number_of_handles_to_signal; i++) - // Randomly select a handle to signal. - task.signal (ACE_OS::rand() % number_of_handles); - } - - // Sleep for a while - ACE_OS::sleep (interval); - - // End the Reactor event loop - ACE_Reactor::end_event_loop (); - - // Wait for all threads to exit - ACE_Thread_Manager::instance ()->wait (); - - // Delete dynamic resources; this is necessary since it will destroy - // the Reactor instance. If we wait for the Object Manager to do - // this, it will be too late since Task_Handler instance would have - // disappeared. - ACE_Service_Config::close_singletons (); - - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_network_events.cpp b/examples/Reactor/WFMO_Reactor/test_network_events.cpp deleted file mode 100644 index eed8464bf8b..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_network_events.cpp +++ /dev/null @@ -1,191 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_network_events.cpp -// -// = DESCRIPTION -// -// This application tests Reactor to make sure that it responds -// correctly to different kinds of network events. -// -// The test starts off by creating a Network_Listener, that listens -// for connections at ACE_DEFAULT_SERVER_PORT. When a client -// connects, a Network_Handler is created. Network_Handler reads -// messages off the socket and prints them out. This is done until -// the remote side shuts down. Multiple clients can connect at the -// same time. -// -// Events tested in this example includes ACCEPT, READ, and CLOSE masks. -// -// To run this example, start an instance of this example and -// connect to it using telnet (to port -// ACE_DEFAULT_SERVER_PORT(10002)). -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" -#include "ace/WFMO_Reactor.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_Stream.h" -#include "ace/SOCK_Acceptor.h" - -ACE_RCSID(ReactorEx, test_network_events, "$Id$") - -class Network_Handler : public ACE_Event_Handler -{ -public: - Network_Handler (ACE_SOCK_Stream &s); - // Default constructor - - virtual int handle_input (ACE_HANDLE handle); - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - virtual ACE_HANDLE get_handle (void) const; - - ACE_SOCK_Stream stream_; - -}; - -Network_Handler::Network_Handler (ACE_SOCK_Stream &s) - : stream_ (s) -{ - this->reactor (ACE_Reactor::instance ()); - - ACE_ASSERT (this->reactor ()->register_handler (this, READ_MASK) == 0); -} - -ACE_HANDLE -Network_Handler::get_handle (void) const -{ - return this->stream_.get_handle (); -} - -int -Network_Handler::handle_input (ACE_HANDLE handle) -{ - ACE_DEBUG ((LM_DEBUG, "Network_Handler::handle_input handle = %d\n", handle)); - - while (1) - { - char message[BUFSIZ]; - int result = this->stream_.recv (message, sizeof message); - if (result > 0) - { - message[result] = 0; - ACE_DEBUG ((LM_DEBUG, "Remote message: %s\n", message)); - } - else if (result == 0) - { - ACE_DEBUG ((LM_DEBUG, "Connection closed\n")); - return -1; - } - else if (errno == EWOULDBLOCK) - { - return 0; - } - else - { - ACE_DEBUG ((LM_DEBUG, "Problems in receiving data, result = %d", result)); - return -1; - } - } -} - -int -Network_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_DEBUG ((LM_DEBUG, "Network_Handler::handle_close handle = %d\n", handle)); - - this->stream_.close (); - delete this; - return 0; -} - -class Network_Listener : public ACE_Event_Handler -{ -public: - Network_Listener (void); - // Default constructor - - virtual int handle_input (ACE_HANDLE handle); - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - ACE_HANDLE get_handle (void) const; - - ACE_INET_Addr local_address_; - ACE_SOCK_Acceptor acceptor_; -}; - -Network_Listener::Network_Listener (void) - : local_address_ (ACE_DEFAULT_SERVER_PORT), - acceptor_ (local_address_, 1) -{ - this->reactor (ACE_Reactor::instance ()); - ACE_ASSERT (this->reactor ()->register_handler (this, - ACE_Event_Handler::ACCEPT_MASK) == 0); -} - -ACE_HANDLE -Network_Listener::get_handle (void) const -{ - return this->acceptor_.get_handle (); -} - -int -Network_Listener::handle_input (ACE_HANDLE handle) -{ - ACE_DEBUG ((LM_DEBUG, "Network_Listener::handle_input handle = %d\n", handle)); - - ACE_INET_Addr remote_address; - ACE_SOCK_Stream stream; - - // Try to find out if the implementation of the reactor that we are - // using requires us to reset the event association for the newly - // created handle. This is because the newly created handle will - // inherit the properties of the listen handle, including its event - // associations. - int reset_new_handle = this->reactor ()->uses_event_associations (); - - ACE_ASSERT (this->acceptor_.accept (stream, // stream - &remote_address, // remote address - 0, // timeout - 1, // restart - reset_new_handle // reset new handler - ) == 0); - - ACE_DEBUG ((LM_DEBUG, "Remote connection from: ")); - remote_address.dump (); - - Network_Handler *handler = new Network_Handler (stream); - - return 0; -} - -int -Network_Listener::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_DEBUG ((LM_DEBUG, "Network_Listener::handle_close handle = %d\n", handle)); - - this->acceptor_.close (); - return 0; -} - -int -main (int, char *[]) -{ - Network_Listener listener; - - ACE_Reactor::run_event_loop (); - - return 0; -}; diff --git a/examples/Reactor/WFMO_Reactor/test_prerun_state_changes.cpp b/examples/Reactor/WFMO_Reactor/test_prerun_state_changes.cpp deleted file mode 100644 index ddd54e682f0..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_prerun_state_changes.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// $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" - -ACE_RCSID(ReactorEx, test_prerun_state_changes, "$Id$") - -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 | ACE_Event_Handler::DONT_CALL) == 0); - - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_registration.cpp b/examples/Reactor/WFMO_Reactor/test_registration.cpp deleted file mode 100644 index cd34d60609a..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_registration.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_registration.cpp -// -// = DESCRIPTION -// -// This test application tests a wide range of registration, -// suspension, resumption, and removal of events from Reactor. -// -// The application initially registers two events with Reactor. A -// auxiliary thread is created to do the signaling on the -// events. When the first event is signaled, the event is suspended -// from Reactor. The event is then signaled again, but is "lost" -// since the handler has been suspended. When the second event is -// signal, the first event is resumed and the second is -// suspended. When the first event is signaled again, both events -// are removed from Reactor. -// -// This test shows off the following features of Reactor: -// - Registration -// - Suspension -// - Resumption -// - Removal (while active and while suspended) -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" - -ACE_RCSID(ReactorEx, test_registration, "$Id$") - -// Globals for this test -int stop_test = 0; -ACE_Reactor reactor; - - -class Simple_Handler : public ACE_Event_Handler -{ -public: - Simple_Handler (void); - // Default constructor - - virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - - ACE_Auto_Event event1_; - ACE_Auto_Event event2_; - int handle_signal_count_; - int handle_close_count_; -}; - -Simple_Handler::Simple_Handler (void) - : handle_signal_count_ (0), - handle_close_count_ (0) -{ -} - -int -Simple_Handler::handle_signal (int signum, siginfo_t *s, ucontext_t *) -{ - ACE_HANDLE handle = s->si_handle_; - - this->handle_signal_count_++; - - if (this->handle_signal_count_ == 1) - this->reactor ()->suspend_handler (event1_.handle ()); - else if (this->handle_signal_count_ == 2) - { - this->reactor ()->resume_handler (event1_.handle ()); - this->reactor ()->suspend_handler (event2_.handle ()); - } - else if (this->handle_signal_count_ == 3) - { - this->reactor ()->remove_handler (event1_.handle (), - ACE_Event_Handler::NULL_MASK); - this->reactor ()->remove_handler (event2_.handle (), - ACE_Event_Handler::NULL_MASK); - } - return 0; -} - -int -Simple_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_DEBUG ((LM_DEBUG, "Simple_Handler::handle_close handle = %d\n", handle)); - this->handle_close_count_++; - - if (this->handle_close_count_ == 1) - stop_test = 0; - else if (this->handle_close_count_ == 2) - stop_test = 1; - - return 0; -} - -// Globals for this test -Simple_Handler simple_handler; - -void -worker (void) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) Thread creation\n")); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread sleeping\n")); - ACE_OS::sleep (1); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread signaling %d\n", simple_handler.event1_.handle())); - simple_handler.event1_.signal (); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread sleeping\n")); - ACE_OS::sleep (1); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread signaling %d\n", simple_handler.event1_.handle())); - ACE_DEBUG ((LM_DEBUG, "Note: This signal should be \"lost\" because of the suspended handler\n")); - simple_handler.event1_.signal (); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread sleeping\n")); - ACE_OS::sleep (1); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread resetting %d\n", simple_handler.event1_.handle())); - simple_handler.event1_.reset (); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread signaling %d\n", simple_handler.event2_.handle())); - simple_handler.event2_.signal (); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread sleeping\n")); - ACE_OS::sleep (1); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread signaling %d\n", simple_handler.event1_.handle())); - simple_handler.event1_.signal (); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread death\n")); -} - -int -main (int, char *[]) -{ - ACE_ASSERT (reactor.register_handler (&simple_handler, - simple_handler.event1_.handle ()) == 0); - ACE_ASSERT (reactor.register_handler (&simple_handler, - simple_handler.event2_.handle ()) == 0); - - ACE_ASSERT (ACE_OS::thr_create ((ACE_THR_FUNC) worker, 0, 0, 0) == 0); - - int result = 0; - while (!stop_test && result != -1) - { - result = reactor.handle_events (); - } - return 0; -}; diff --git a/examples/Reactor/WFMO_Reactor/test_registry_changes.cpp b/examples/Reactor/WFMO_Reactor/test_registry_changes.cpp deleted file mode 100644 index 9b0fc9f5930..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_registry_changes.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_registry_changes.cpp -// -// = DESCRIPTION -// -// This application tests the working of Reactor when users are -// interested in monitoring changes in the registry. -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" -#include "ace/Registry.h" - -ACE_RCSID(ReactorEx, test_registry_changes, "$Id$") - -static int stop_test = 0; -static HKEY context_to_monitor = HKEY_CURRENT_USER; -static LPCTSTR temp_context_name = ACE_TEXT ("ACE temporary context"); - -class Event_Handler : public ACE_Event_Handler -{ -public: - Event_Handler (ACE_Reactor &reactor); - ~Event_Handler (void); - int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); - ACE_Registry::Naming_Context &context (void); - -private: - ACE_Auto_Event event_; - ACE_Registry::Naming_Context context_; -}; - -Event_Handler::Event_Handler (ACE_Reactor &reactor) - : context_ (context_to_monitor) -{ - this->reactor (&reactor); - - if (::RegNotifyChangeKeyValue (this->context_.key (), // handle of key to watch - FALSE, // flag for subkey notification - REG_NOTIFY_CHANGE_NAME, // changes to be reported - this->event_.handle (), // handle of signaled event - TRUE // flag for asynchronous reporting - ) != ERROR_SUCCESS) - ACE_ERROR ((LM_ERROR, "RegNotifyChangeKeyValue could not be setup\n")); - - if (this->reactor ()->register_handler (this, - this->event_.handle ()) != 0) - ACE_ERROR ((LM_ERROR, "Registration with Reactor could not be done\n")); -} - -Event_Handler::~Event_Handler (void) -{ -} - -int -Event_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - if (stop_test) - this->reactor ()->close (); - else if (::RegNotifyChangeKeyValue (this->context_.key (), // handle of key to watch - FALSE, // flag for subkey notification - REG_NOTIFY_CHANGE_NAME, // changes to be reported - this->event_.handle (), // handle of signaled event - TRUE // flag for asynchronous reporting - ) != ERROR_SUCCESS) - ACE_ERROR ((LM_ERROR, - "RegNotifyChangeKeyValue could not be setup\n")); - return 0; -} - -int -Event_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - ACE_DEBUG ((LM_DEBUG, "Event_Handler removed from Reactor\n")); - return 0; -} - -ACE_Registry::Naming_Context & -Event_Handler::context (void) -{ - return this->context_; -} - -void -worker (Event_Handler *event_handler) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) Thread creation\n")); - ACE_DEBUG ((LM_DEBUG, "(%t) Thread creating temporary registry entry\n")); - - ACE_Registry::Naming_Context temp_context; - int result = event_handler->context ().bind_new_context (temp_context_name, - temp_context); - - if (result == -1) - ACE_ERROR ((LM_ERROR, "Error in creating %s: %p\n", temp_context_name, "bind_new_context")); - else - { - ACE_DEBUG ((LM_DEBUG, "(%t) Thread sleeping\n")); - ACE_OS::sleep (3); - - ACE_DEBUG ((LM_DEBUG, "(%t) Thread removing registry entry\n")); - stop_test = 1; - event_handler->context ().unbind_context (temp_context_name); - } -} - -int -main (int, char *[]) -{ - ACE_Reactor reactor; - Event_Handler handler (reactor); - - ACE_ASSERT (ACE_OS::thr_create ((ACE_THR_FUNC) worker, &handler, 0, 0) == 0); - - int result = 0; - while (result != -1) - result = reactor.handle_events (); - - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_removals.cpp b/examples/Reactor/WFMO_Reactor/test_removals.cpp deleted file mode 100644 index 2a826fb7d3f..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_removals.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_removals.cpp -// -// = DESCRIPTION -// -// Tests the Reactor's ability to handle simultaneous events. If -// you pass anything on the command-line, then each handler -// requests to be removed from the Reactor after each event. -// -// = AUTHOR -// Tim Harrison -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" -#include "ace/Service_Config.h" -#include "ace/Synch.h" - -ACE_RCSID(ReactorEx, test_removals, "$Id$") - -class Event_Handler : public ACE_Event_Handler -// = TITLE -// Generic Event Handler. -// -// = DESCRIPTION -// -// Creates event. Registers with Reactor. Signals event. If -// created with -close_down- it returns -1 from handle signal. -{ -public: - Event_Handler (int event_number, - int close_down) - : event_number_ (event_number), - close_down_ (close_down) - { - if (ACE_Reactor::instance ()->register_handler (this, - this->event_.handle ()) == -1) - ACE_ERROR ((LM_ERROR, "%p\tevent handler %d cannot be added to Reactor\n", "", event_number_)); - this->event_.signal (); - } - - virtual int handle_signal (int index, siginfo_t *, ucontext_t *) - { - if (this->close_down_) - return -1; - else - return 0; - } - - virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask) - { - ACE_DEBUG ((LM_DEBUG, "event handler %d closed.\n", event_number_)); - delete this; - return 0; - } - - virtual ACE_HANDLE get_handle (void) const - { - return event_.handle (); - } - -private: - int event_number_; - // Our event number. - - int close_down_; - // Shall we close down or not. - - ACE_Event event_; - // Signaled to shut down the handler. -}; - -int -main (int argc, char *argv[]) -{ - int close_down = argc > 1 ? 1 : 0; - - for (size_t i = 1; i <= ACE_Reactor::instance ()->size (); i++) - new Event_Handler (i, close_down); - - int result = 0; - ACE_Time_Value time (1); - while (1) - { - result = ACE_Reactor::instance ()->handle_events (time); - if (result == 0 && errno == ETIME) - { - ACE_DEBUG ((LM_DEBUG, "No more work left: timing out\n")); - break; - } - if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); - } - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_talker.cpp b/examples/Reactor/WFMO_Reactor/test_talker.cpp deleted file mode 100644 index 56d9ef3fc37..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_talker.cpp +++ /dev/null @@ -1,558 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_talker.cpp -// -// = DESCRIPTION -// -// This test application tests a wide range of events that can be -// demultiplexed using various ACE utilities. Events used include -// ^C events, reading from STDIN, vanilla Win32 events, thread -// exits, Reactor notifications, proactive reads, and proactive -// writes. -// -// The proactive I/O events are demultiplexed by the ACE_Proactor. -// The thread exits, notications, and vanilla Win32 events are -// demultiplexed by the ACE_Reactor. To enable a single thread -// to run all these events, the Proactor is integrated with the -// Reactor. -// -// The test application prototypes a simple talk program. Two -// instances of the application connect. Input from either console -// is displayed on the others console also. Because of the evils -// of Win32 STDIN, a separate thread is used to read from STDIN. -// To test the Proactor and Reactor, I/O between the remote -// processes is performed proactively and interactions between the -// STDIN thread and the main thread are performed reactively. -// -// The following description of the test application is in two -// parts. The participants section explains the main components -// involved in the application. The collaboration section -// describes how the partipants interact in response to the -// multiple event types which occur. -// -// The Reactor test application has the following participants: -// -// . Reactor -- The Reactor demultiplexes Win32 "waitable" -// events using WaitForMultipleObjects. -// -// . Proactor -- The proactor initiates and demultiplexes -// overlapped I/O operations. The Proactor registers with the -// Reactor so that a single-thread can demultiplex all -// application events. -// -// . STDIN_Handler -- STDIN_Handler is an Active Object which reads -// from STDIN and forwards the input to the Peer_Handler. This -// runs in a separate thread to make the test more interesting. -// However, STDIN is "waitable", so in general it can be waited on -// by the ACE Reactor, thanks MicroSlush! -// -// . Peer_Handler -- The Peer_Handler connects to another instance -// of test_reactor. It Proactively reads and writes data to the -// peer. When the STDIN_Handler gives it messages, it fowards them -// to the remote peer. When it receives messages from the remote -// peer, it prints the output to the console. -// -// The collaborations of the participants are as follows: -// -// . Initialization -// -// Peer_Handler -- connects to the remote peer. It then begins -// proactively reading from the remote connection. Note that it -// will be notified by the Proactor when a read completes. It -// also registers a notification strategy with message queue so -// that it is notified when the STDIN_Handler posts a message -// onto the queue. -// -// STDIN_Handler -- STDIN_Handler registers a signal handler for -// SIGINT. This just captures the exception so that the kernel -// doesn't kill our process; We want to exit gracefully. It also -// creates an Exit_Hook object which registers the -// STDIN_Handler's thread handle with the Reactor. The -// Exit_Hook will get called back when the STDIN_Handler thread -// exits. After registering these, it blocks reading from STDIN. -// -// Proactor -- is registered with the Reactor. -// -// The main thread of control waits in the Reactor. -// -// . STDIN events -- When the STDIN_Handler thread reads from -// STDIN, it puts the message on Peer_Handler's message queue. It -// then returns to reading from STDIN. -// -// . Message enqueue -- The Reactor thread wakes up and calls -// Peer_Handler::handle_output. The Peer_Handler then tries to -// dequeue a message from its message queue. If it can, the -// message is Proactively sent to the remote peer. Note that the -// Peer_Handler will be notified with this operation is complete. -// The Peer_Handler then falls back into the Reactor event loop. -// -// . Send complete event -- When a proactive send is complete, the -// Proactor is notified by the Reactor. The Proactor, in turn, -// notifies the Peer_Handler. The Peer_Handler then checks for -// more messages from the message queue. If there are any, it -// tries to send them. If there are not, it returns to the -// Reactor event loop. -// -// . Read complete event -- When a proactive read is complete (the -// Peer_Handler initiated a proactive read when it connected to the -// remote peer), the Proactor is notified by the Reactor. The -// Proactor, in turn notifies the Peer_Handler. If the read was -// successful the Peer_Handler just displays the received msg to -// the console and reinvokes a proactive read from the network -// connection. If the read failed (i.e. the remote peer exited), -// the Peer_Handler sets a flag to end the event loop and returns. -// This will cause the application to exit. -// -// . ^C events -- When the user types ^C at the console, the -// STDIN_Handler's signal handler will be called. It does nothing, -// but as a result of the signal, the STDIN_Handler thread will -// exit. -// -// . STDIN_Handler thread exits -- The Exit_Hook will get called -// back from the Reactor. Exit_Hook::handle_signal sets a flag -// to end the event loop and returns. This will cause the -// application to exit. -// -// -// To run example, start an instance of the test with an optional -// local port argument (as the acceptor). Start the other instance -// with -h <hostname> and -p <server port>. Type in either the -// client or server windows and your message should show up in the -// other window. Control C to exit. -// -// = AUTHOR -// Tim Harrison -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" -#include "ace/WIN32_Proactor.h" -#include "ace/Proactor.h" -#include "ace/SOCK_Connector.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/Get_Opt.h" -#include "ace/Service_Config.h" -#include "ace/Synch.h" -#include "ace/Task.h" - -ACE_RCSID(ReactorEx, test_talker, "$Id$") - -typedef ACE_Task<ACE_MT_SYNCH> MT_TASK; - -class Peer_Handler : public MT_TASK, public ACE_Handler -// = TITLE -// Connect to a server. Receive messages from STDIN_Handler -// and forward them to the server using proactive I/O. -{ -public: - // = Initialization methods. - Peer_Handler (int argc, char *argv[]); - ~Peer_Handler (void); - - int open (void * =0); - // This method creates the network connection to the remote peer. - // It does blocking connects and accepts depending on whether a - // hostname was specified from the command line. - - virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); - // This method will be called when an asynchronous read completes on a stream. - // The remote peer has sent us something. If it succeeded, print - // out the message and reinitiate a read. Otherwise, fail. In both - // cases, delete the message sent. - - virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); - // This method will be called when an asynchronous write completes on a strea_m. - // One of our asynchronous writes to the remote peer has completed. - // Make sure it succeeded and then delete the message. - - virtual ACE_HANDLE handle (void) const; - // Get the I/O handle used by this <handler>. This method will be - // called by the ACE_Asynch_* classes when an ACE_INVALID_HANDLE is - // passed to <open>. - - virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); - // We've been removed from the Reactor. - - virtual int handle_output (ACE_HANDLE fd); - // Called when output events should start. Note that this is - // automatically invoked by the - // <ACE_Reactor_Notificiation_Strategy>. - -private: - ACE_SOCK_Stream stream_; - // Socket that we have connected to the server. - - ACE_Reactor_Notification_Strategy strategy_; - // The strategy object that the reactor uses to notify us when - // something is added to the queue. - - // = Remote peer info. - char *host_; - // Name of remote host. - - u_short port_; - // Port number for remote host. - - ACE_Asynch_Read_Stream rd_stream_; - // Read stream - - ACE_Asynch_Write_Stream wr_stream_; - // Write stream - - ACE_Message_Block mb_; - // Message Block for reading from the network -}; - -class STDIN_Handler : public ACE_Task<ACE_NULL_SYNCH> -// = TITLE -// Active Object. Reads from STDIN and passes message blocks to -// the peer handler. -{ -public: - STDIN_Handler (MT_TASK &ph); - // Initialization. - - virtual int open (void * = 0); - // Activate object. - - virtual int close (u_long = 0); - // Shut down. - - int svc (void); - // Thread runs here as an active object. - -private: - static void handler (int signum); - // Handle a ^C. (Do nothing, this just illustrates how we can catch - // signals along with the other things). - - void register_thread_exit_hook (void); - // Helper function to register with the Reactor for thread exit. - - virtual int handle_signal (int index, siginfo_t *, ucontext_t *); - // The STDIN thread has exited. This means the user hit ^C. We can - // end the event loop. - - MT_TASK &ph_; - // Send all input to ph_. - - ACE_HANDLE thr_handle_; - // Handle of our thread. -}; - -Peer_Handler::Peer_Handler (int argc, char *argv[]) - : host_ (0), - port_ (ACE_DEFAULT_SERVER_PORT), - strategy_ (ACE_Reactor::instance (), - this, - ACE_Event_Handler::WRITE_MASK), - mb_ (BUFSIZ) -{ - // This code sets up the message to notify us when a new message is - // added to the queue. Actually, the queue notifies Reactor which - // then notifies us. - this->msg_queue ()->notification_strategy (&this->strategy_); - - ACE_Get_Opt get_opt (argc, argv, "h:p:"); - int c; - - while ((c = get_opt ()) != EOF) - { - switch (c) - { - case 'h': - host_ = get_opt.optarg; - break; - case 'p': - port_ = ACE_OS::atoi (get_opt.optarg); - break; - } - } -} - -Peer_Handler::~Peer_Handler (void) -{ -} - -// This method creates the network connection to the remote peer. It -// does blocking connects and accepts depending on whether a hostname -// was specified from the command line. - -int -Peer_Handler::open (void *) -{ - if (host_ != 0) // Connector - { - ACE_INET_Addr addr (port_, host_); - ACE_SOCK_Connector connector; - - // Establish connection with server. - if (connector.connect (stream_, addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), -1); - - ACE_DEBUG ((LM_DEBUG, "(%t) connected.\n")); - } - else // Acceptor - { - ACE_SOCK_Acceptor acceptor; - ACE_INET_Addr local_addr (port_); - - if ((acceptor.open (local_addr) == -1) || - (acceptor.accept (this->stream_) == -1)) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "accept failed"), -1); - - ACE_DEBUG ((LM_DEBUG, "(%t) accepted.\n")); - } - - int result = this->rd_stream_.open (*this); - if (result != 0) - return result; - - result = this->wr_stream_.open (*this); - if (result != 0) - return result; - - result = this->rd_stream_.read (this->mb_, - this->mb_.size ()); - return result; -} - -// One of our asynchronous writes to the remote peer has completed. -// Make sure it succeeded and then delete the message. - -void -Peer_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) -{ - if (result.bytes_transferred () <= 0) - ACE_DEBUG ((LM_DEBUG, "(%t) %p bytes = %d\n", "Message failed", - result.bytes_transferred ())); - - // This was allocated by the STDIN_Handler, queued, dequeued, passed - // to the proactor, and now passed back to us. - result.message_block ().release (); -} - -// The remote peer has sent us something. If it succeeded, print -// out the message and reinitiate a read. Otherwise, fail. In both -// cases, delete the message sent. - - -void -Peer_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) -{ - if (result.bytes_transferred () > 0 && - this->mb_.length () > 0) - { - this->mb_.rd_ptr ()[result.bytes_transferred ()] = '\0'; - // Print out the message received from the server. - ACE_DEBUG ((LM_DEBUG, "%s", this->mb_.rd_ptr ())); - } - else - { - // If a read failed, we will assume it's because the remote peer - // went away. We will end the event loop. Since we're in the - // main thread, we don't need to do a notify. - ACE_Reactor::end_event_loop(); - return; - } - - // Reset pointers - this->mb_.wr_ptr (this->mb_.wr_ptr () - result.bytes_transferred ()); - - // Start off another read - if (this->rd_stream_.read (this->mb_, - this->mb_.size ()) == -1) - ACE_ERROR ((LM_ERROR, "%p Read initiate.\n", "Peer_Handler")); -} - -// This is so the Proactor can get our handle. -ACE_HANDLE -Peer_Handler::handle (void) const -{ - return this->stream_.get_handle (); -} - -// We've been removed from the Reactor. -int -Peer_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) Peer_Handler closing down\n")); - return 0; -} - -// New stuff added to the message queue. Try to dequeue a message. -int -Peer_Handler::handle_output (ACE_HANDLE fd) -{ - ACE_Message_Block *mb; - - ACE_Time_Value tv (ACE_Time_Value::zero); - - // Forward the message to the remote peer receiver. - if (this->getq (mb, &tv) != -1) - { - if (this->wr_stream_.write (*mb, - mb->length ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p Write initiate.\n", "Peer_Handler"), -1); - } - return 0; -} - -void -STDIN_Handler::handler (int signum) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) signal = %S\n", signum)); -} - -STDIN_Handler::STDIN_Handler (MT_TASK &ph) - : ph_ (ph) -{ - // Register for ^C from the console. We just need to catch the - // exception so that the kernel doesn't kill our process. - // Registering this signal handler just tells the kernel that we - // know what we're doing; to leave us alone. - - ACE_OS::signal (SIGINT, (ACE_SignalHandler) STDIN_Handler::handler); -}; - -// Activate object. - -int -STDIN_Handler::open (void *) -{ - if (this->activate (THR_NEW_LWP | THR_DETACHED) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn"), -1); - - return 0; -} - -// Shut down. - -int -STDIN_Handler::close (u_long) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) thread is exiting.\n")); - return 0; -} - -// Thread runs here. - -int -STDIN_Handler::svc (void) -{ - this->register_thread_exit_hook (); - - for (;;) - { - ACE_Message_Block *mb = new ACE_Message_Block (BUFSIZ); - - // Read from stdin into mb. - int read_result = ACE_OS::read (ACE_STDIN, - mb->rd_ptr (), - mb->size ()); - - // If read succeeds, put mb to peer handler, else end the loop. - if (read_result > 0) - { - mb->wr_ptr (read_result); - // Note that this call will first enqueue mb onto the peer - // handler's message queue, which will then turn around and - // notify the Reactor via the Notification_Strategy. This - // will subsequently signal the Peer_Handler, which will - // react by calling back to its handle_output() method, - // which dequeues the message and sends it to the peer - // across the network. - this->ph_.putq (mb); - } - else - { - mb->release (); - break; - } - } - - // handle_signal will get called on the main proactor thread since - // we just exited and the main thread is waiting on our thread exit. - return 0; -} - -// Register an exit hook with the reactor. - -void -STDIN_Handler::register_thread_exit_hook (void) -{ - // Get a real handle to our thread. - ACE_Thread_Manager::instance ()->thr_self (this->thr_handle_); - - // Register ourselves to get called back when our thread exits. - - if (ACE_Reactor::instance ()-> - register_handler (this, this->thr_handle_) == -1) - ACE_ERROR ((LM_ERROR, "Exit_Hook Register failed.\n")); -} - -// The STDIN thread has exited. This means the user hit ^C. We can -// end the event loop and delete ourself. - -int -STDIN_Handler::handle_signal (int, siginfo_t *si, ucontext_t *) -{ - ACE_ASSERT (this->thr_handle_ == si->si_handle_); - ACE_Reactor::end_event_loop (); - return 0; -} - -int -main (int argc, char *argv[]) -{ - // Let the proactor know that it will be used with Reactor - // Create specific proactor - ACE_WIN32_Proactor win32_proactor (0, 0, 1); - // Get the interface proactor - ACE_Proactor proactor (&win32_proactor); - // Put it as the instance. - ACE_Proactor::instance (&proactor); - - // Open handler for remote peer communications this will run from - // the main thread. - Peer_Handler peer_handler (argc, argv); - - if (peer_handler.open () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p open failed, errno = %d.\n", - "peer_handler", errno), 0); - - // Open active object for reading from stdin. - STDIN_Handler stdin_handler (peer_handler); - - // Spawn thread. - if (stdin_handler.open () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p open failed, errno = %d.\n", - "stdin_handler", errno), 0); - - // Register proactor with Reactor so that we can demultiplex - // "waitable" events and I/O operations from a single thread. - if (ACE_Reactor::instance ()->register_handler - (ACE_Proactor::instance ()->implementation ()) != 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p failed to register Proactor.\n", - argv[0]), -1); - - // 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/test_timeouts.cpp b/examples/Reactor/WFMO_Reactor/test_timeouts.cpp deleted file mode 100644 index d23a55aa089..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_timeouts.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_timeouts.cpp -// -// = DESCRIPTION -// -// This example application shows how to write Reactor event -// loops that handle events for some fixed amount of time. -// -// Run this example (without arguments) to see the timers -// expire. The order should be: -// -// foo, bar, foo, bar, foo, foo, bar, foo, bar, foo -// -// = AUTHOR -// Tim Harrison -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Reactor.h" -#include "ace/Service_Config.h" -#include "ace/OS.h" - -ACE_RCSID(ReactorEx, test_timeouts, "$Id$") - -class Timeout_Handler : public ACE_Event_Handler -// = TITLE -// Generic timeout handler. -{ -public: - Timeout_Handler (void) - : count_ (0) {} - - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg) - // Print out when timeouts occur. - { - ACE_DEBUG ((LM_DEBUG, - "%d timeout occurred for %s.\n", - ++count_, - (char *) arg)); - return 0; - } - -private: - int count_; -}; - -int -main (int, char *[]) -{ - Timeout_Handler handler; - - // Register a 3 second timer. - ACE_Time_Value bar_tv (3); - ACE_Reactor::instance ()->schedule_timer (&handler, - (void *) "Bar", - bar_tv, - bar_tv); - - // Register a 2 second timer. - ACE_Time_Value foo_tv (2); - ACE_Reactor::instance ()->schedule_timer (&handler, - (void *) "Foo", - foo_tv, - foo_tv); - // Handle events for 12 seconds. - ACE_Time_Value run_time (12); - if (ACE_Reactor::run_event_loop(run_time) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); - - return 0; -} diff --git a/examples/Reactor/WFMO_Reactor/test_window_messages.cpp b/examples/Reactor/WFMO_Reactor/test_window_messages.cpp deleted file mode 100644 index d63730b84ab..00000000000 --- a/examples/Reactor/WFMO_Reactor/test_window_messages.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// examples -// -// = FILENAME -// test_window_messages.cpp -// -// = DESCRIPTION -// -// Tests the Msg_WFMO_Reactor's ability to handle regular events -// and window messages. -// -// = AUTHOR -// -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Msg_WFMO_Reactor.h" -#include "ace/Auto_Ptr.h" - -ACE_RCSID(ReactorEx, test_window_messages, "$Id$") - -class Event_Handler : public ACE_Event_Handler -{ -public: - int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - - ACE_Auto_Event handle_; - int iterations_; -}; - -int -Event_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - --this->iterations_; - - if (this->iterations_ == 0) - ACE_Reactor::end_event_loop (); - - return 0; -} - -Event_Handler event_handler; - -void WINAPI -timer_callback (HWND hwnd, - UINT uMsg, - UINT idEvent, - DWORD dwTime) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) timeout occured @ %d\n", dwTime)); - - event_handler.handle_.signal (); -} - -int -main (int argc, char** argv) -{ - // Manage memory automagically. - // Note that ordering here is important. - ACE_Reactor_Impl *impl = new ACE_Msg_WFMO_Reactor; - auto_ptr<ACE_Reactor> reactor (new ACE_Reactor (impl)); - ACE_Reactor::instance (reactor.get ()); - auto_ptr<ACE_Reactor_Impl> delete_impl (impl); - - event_handler.iterations_ = 5; - ACE_ASSERT (ACE_Reactor::instance ()->register_handler (&event_handler, - event_handler.handle_.handle ()) == 0); - - ACE_Time_Value timeout (1); - ACE_ASSERT (::SetTimer (NULL, // handle of window for timer messages - NULL, // timer identifier - timeout.msec (), // time-out value - (TIMERPROC) &timer_callback // address of timer procedure - ) != 0); - - ACE_Reactor::run_event_loop (); - - return 0; -} - |