From 5e39b74c3bf1739e08286d6bfd082e387333b2de Mon Sep 17 00:00:00 2001 From: schmidt Date: Sat, 28 Dec 1996 19:31:56 +0000 Subject: foo --- ACE-INSTALL.html | 230 ++++++++++++++++++++++++++++++++++++------ ChangeLog-96b | 11 ++ ace/Module.h | 20 ++-- ace/OS.cpp | 2 +- ace/Parse_Node.h | 1 - ace/Service_Record.cpp | 27 +++-- ace/Service_Record.h | 1 - ace/Stream.cpp | 25 +++-- examples/Threads/task_two.cpp | 10 +- netsvcs/ACE-netsvcs.html | 5 +- 10 files changed, 263 insertions(+), 69 deletions(-) diff --git a/ACE-INSTALL.html b/ACE-INSTALL.html index d7ed01e12cc..caa72aabed4 100644 --- a/ACE-INSTALL.html +++ b/ACE-INSTALL.html @@ -2,7 +2,7 @@ -Installing ACE +Building and Installing ACE and Its Network Services
-

Installation Notes for the ADAPTIVE Communication Environment (ACE)

+

Building and Installing ACE and Its Network Services

Synopsis

-The file explains how to build ACE on the various UNIX and Win32 -platforms that it has been ported to. Please make sure you read the -ACE FAQ before installing ACE. In -addition, please consult the ChangeLog file to -see whether any recent changes to the release will affect your code. +The file explains how to build and install ACE and its Network +Services on the various OS platforms and compilers that it has been +ported to. Please consult the ChangeLog file +to see whether any recent changes to the release will affect your +code. In addition, you might want to read the ACE FAQ before building and installing ACE.

Document Index

@@ -34,9 +35,13 @@ see whether any recent changes to the release will affect your code.

Supported Platforms and Compilers

The ADAPTIVE Communication Environment has been ported and tested -extensively on a wide range of C++ compilers and OS platforms. If you +extensively on a wide range of C++ compilers and uni-processor and +multi-process OS platforms including Win32 (i.e., WinNT and Win95), +most versions of UNIX (e.g., SunOS 4.x and 5.x, SGI IRIX, HP-UX, +OSF/1, AIX, Linux, and SCO), VxWorks, and MVS OpenEdition. If you have a problem compiling the ACE wrappers on the platforms shown below -please let me know and I'll try to fix it for you. +please send email to the ACE +mailing list and we'll try to fix it for you.
Win32 (Windows NT and Windows '95)

@@ -176,12 +181,19 @@ If you use the GNU GCC C++ compiler please note the following:


+ + +

Building and Installing ACE

+ +The following explains how to build the ACE on UNIX and Win32. + -

Installation Process for UNIX

+

Building and Installing ACE on UNIX

-The installation process for installing ACE on UNIX is relatively -simple (the Windows NT installation process is different). Here's -what you need to do:

+Building and installing ACE on UNIX is relatively simple (the process for Win32 is different). Here's what you +need to do:

  1. Install GNU make 3.7 or greater on your system (available via @@ -223,8 +235,8 @@ what you need to do:

  2. Note that since ACE builds shared libraries, you'll need to set LD_LIBRARY_PATH to whereever you put the binary version of the - libraries. For example, you probably want to do somethink like the - following

    + ACE library. For example, you probably want to do something like + the following

    
     % setenv LD_LIBRARY_PATH $WRAPPER_ROOT/ace:$LD_LIBRARY_PATH 

    @@ -243,10 +255,10 @@ what you need to do:


    -

    Installation Process for Windows NT and Windows '95 Static and Dynamic Libraries

    +

    Building and Installing ACE on Win32

    -The installation process for NT is a bit different than UNIX. First, -I assume you're using MSVC++ 4.0(things are a little different for the +The installation process for NT is a bit different than UNIX. We +assume you're using MSVC++ 4.x (things are a little different for the 2.0 version...).

      @@ -324,10 +336,10 @@ I assume you're using MSVC++ 4.0(things are a little different for the applications link setup. Do this by including wsock32.lib in the project through Insert/Files_into_project.

      - When building a DLL: In order to allow standard C library functions + When building a DLL we must ensure that both dll and exe are using + the same libraries In order to allow standard C library functions to share common variables (particular errno) across dll - and exe boundaries, we must ensure that both dll and exe are using - the same libraries. Go to + and exe boundaries. Go to Build/Settings/C++/Category:Code_Generation. Set Use run-time library to "Multithreaded DLL" or "Debug Multithreaded DLL" depending on whether you're building a release or a debug version @@ -342,16 +354,12 @@ I assume you're using MSVC++ 4.0(things are a little different for the Go to the Build menu and select "Build ace.{lib,dll}". The first time this happens it will rebuild all the dependencies. This may take a while (i.e., 3 to 15 minutes, depending on whether you use - Samba, PC-NFS, native NTFS, etc.). The whole process will seem to - generate lots of errors and warning about not finding many UNIX - header files, etc. Just ignore these errors/warnings. They are - due to the lame MSVC++ compiler that doesn't pay attention to the - #ifdefs when computing the dependencies. Eventually, this process + Samba, PC-NFS, native NTFS, etc.). Eventually, this process will stop and from you won't have to rebuild the dependencies then on (thank God...).

      - At this point, the compiler should be happily chugging away on your - files.

      + At this point, the compiler should be happily chugging away on the + ACE files.

    • USING ace.lib.

      @@ -383,7 +391,7 @@ When it's done, you should have a static or dynamic library same code, we need to remove the /GX flag. Go to Build/Settings/C++/Category:C++ Language. By default, the flag "Enable Exception Handling" should be checked. Click on it to mark - it unchecked. The flag /GX will disappear from Project_Options. + it unchecked. The flag /GX will disappear from Project_Options.

    • SET UP THE LINKER.

      @@ -449,6 +457,166 @@ card. This is one method:

    +
    +
    +

    Building and Installing ACE Network Services

    + +The following explains how to build the ACE
    network services on UNIX and Win32. + + +

    Building and Installing ACE Network Services on UNIX

    + +Building and installing ACE Network Services on UNIX is relatively +simple (the
    process for Win32 is different). +Here's what you need to do:

    + +

      + +
    1. Build and install ACE on UNIX as described earlier. If ACE is built at the root of the ACE +source tree (and ACE has been ported to your platform, of course) the +netsvcs static and shared object libraries should be built +automatically. In addition, the server driver program +(main) contained in +$WRAPPER_ROOT/netsvcs/servers/main.cpp should also be compiled and ready to run.

      + +

    2. Set your LD_LIBRARY_PATH environment variable to where the binary + version of the ACE netsvcs library. For example, you probably + want to do something like the following

      + +

      
      +% setenv LD_LIBRARY_PATH $WRAPPER_ROOT/ace:$LD_LIBRARY_PATH 

      +

      + +
    3. By default, if the shared object library is built, the services + are linked into the main driver program dynamically. + To specify which services should be linked in and executed, edit the + +$WRAPPER_ROOT/netsvcs/servers/svc.conf file. During your editing, + you should update information (such as the default service port + numbers) that affects the initialization of services in this + file. Refer to the Service Configurator + documentation to learn how the configuration file is parsed and + how the services are dynamically linked and executed. In + addition, refer to the Network + Services documentation to learn more about how to configure + each network service.

      + +

    4. If you only want to link the services statically, simply remove + or rename the svc.conf file.

      + +

    + + +

    Building and Installing ACE Network Services on Win32

    + +The installation process for ACE network services on Win32 is a bit +different than UNIX. We assume you're using MSVC++ 4.x (things are a +little different for the 2.0 version...).

    + +

      +
    • Build and install ACE on Win32 as described earlier.

      + +

    • Just like installing the ace directory under ACE_wrappers, + install the new netsvcs directory under ACE_wrappers by copying + all the appropriate files, include netsvcs.mdp and netsvcs.mak.

      + +

    • The easiest thing to do is to use the default netsvcs.mdp and + netsvcs.mak files distributed with the release. Open the + netsvcs.mdp workspace to build netsvcs as a DLL. This project + assumes that you have set the ``global'' include path to include + $WRAPPER_ROOT/netsvcs/lib. This can be done via the following + MSDEV menu item: + + Tools/Options/Directories/Show_Directories_For:Include_Files.

      + +

    • If you choose not to use the given project, the following bullets + explain how to build the ACE netsvcs DLL with MSDEV.

      + +

        +
      1. CREATE A PROJECT WORKSPACE.

        + + Start by making a new project. It should be rooted at + $WRAPPER_ROOT/netsvcs/lib. We normally browse to + $WRAPPER_ROOT/netsvcs, and select "netsvcs" as the project name. + This will cause MSDEV to use the $WRAPPER_ROOT/netsvcs/lib + directory to store the project files. The actual directory and + project name are unimportant, but we'll assume you + named the project "netsvcs." Select the dynamic link library option + and say "ok." By default, the config-win32*.h files are set up to + build DLLs. If you choose to build ACE as a static library you'll + need to unset ACE_HAS_DLL in the config-win32*.h file and select + the static link library option when creating a project workspace.

        + +

      2. INSERT FILES INTO PROJECT.

        + + Go into the Insert menu and select "Files into project". If you're + building a static library, select all the *.cpp files in + $WRAPPER_ROOT/netsvcs/lib into the project.

        + + Once you've selected the files and pressed "ok" it should take a + few seconds or so to for MSDEV to create the project. (Note that + in MSVC2.0 there isn't an Insert menu, so go into the Project Menu + and then "Files" and from there insert all the *.cpp files.) When + including the files on windows 95, it may ask you to select fewer + files than *.cpp. Just do A-M and N-Z or something similar.

        + +

      3. SET THE INCLUDE PATH.

        + + Go into Options section of the Tools menu. Add the $WRAPPER_ROOT/netsvcs/lib + directory to the default directory search path. + Then add $WRAPPER_ROOT\netsvcs to the default library search path. + This means that you can now use relative paths for linking apps + with netsvcs.lib. You may skip this step if you have set + Tools/Options/Directories/Include_Files to include + $WRAPPER_ROOT.

        + + If you are going to compile ACE with UNICODE on, please add UNICODE + to the pre-processor definitions through:

        + + Build -> Settings -> C/C++ -> Preprocessor -> Preprocessor + definitions

        + +

      4. SET UP THE LINKER.

        + + When building a DLL we must ensure that both dll and exe are using + the same libraries in order to allow standard C library functions + to share common variables (particular errno) across dll + and exe boundaries. Go to + Build/Settings/C++/Category:Code_Generation. Set Use run-time + library to "Multithreaded DLL" or "Debug Multithreaded DLL" + depending on whether you're building a release or a debug version + respectively.

        + + When building a static lib: Go to + Build/Settings/C++/Category:Code_Generation and set run-time + library to "Debug Multithreaded" (or just "Multithreaded").

        + +

      5. BUILD.

        + + Go to the Build menu and select "Build netsvcs.{lib,dll}". The first + time this happens it will rebuild all the dependencies. This may + take a while (i.e., 3 to 15 minutes, depending on whether you use + Samba, PC-NFS, native NTFS, etc.). Eventually, this process + will stop and from you won't have to rebuild the dependencies then + on (thank God...).

        + + At this point, the compiler should be happily chugging away on + the netsvcs files.

        + +

      6. USING netsvcs.lib.

        + +When it's done, you should have a static or dynamic library + called netsvcs.lib. You can use this to link with test applications, + including the server driver program.

        +

      +
    +


    Advanced Topics

    diff --git a/ChangeLog-96b b/ChangeLog-96b index a87b3f508f9..1616f57e613 100644 --- a/ChangeLog-96b +++ b/ChangeLog-96b @@ -1,3 +1,14 @@ +Fri Dec 27 23:39:19 1996 Douglas C. Schmidt + + * ace/Stream.cpp (pop): Modified the code so that we don't delete + the Module we are popping unless the flags request this. + + * ace/Service_Record.cpp (fini): Always make sure to first fini() + each Module, then remove() (and delete) them. + + * ace/Stream.cpp (remove): Updated the code so that we don't + delete the Module unless the flags request this. + Thu Dec 26 18:51:22 1996 David L. Levine * ace/config-linux-lxpthreads.h: Has James CE Johnson's diff --git a/ace/Module.h b/ace/Module.h index a1221241628..f587ef7744f 100644 --- a/ace/Module.h +++ b/ace/Module.h @@ -37,19 +37,19 @@ class ACE_Module public: enum { - M_DELETE_NONE = 0, - // Indicates that close() should not delete any tasks. + M_DELETE_NONE = 0, + // Indicates that close() should not delete any tasks. - M_DELETE_READER = 1, - // Indicates that close() should delete the writer thread. + M_DELETE_READER = 1, + // Indicates that close() should delete the writer thread. - M_DELETE_WRITER = 2, - // Indicates that close() should delete the reader thread. + M_DELETE_WRITER = 2, + // Indicates that close() should delete the reader thread. - M_DELETE = 3 - // Indicates that close() deletes the Tasks. Don't change this - // value without updating the same enum in class ACE_Stream... - // The above flags may be or'ed together. + M_DELETE = 3 + // Indicates that close() deletes the Tasks. Don't change this + // value without updating the same enum in class ACE_Stream... + // The above flags may be or'ed together. }; // = Initialization and termination methods. diff --git a/ace/OS.cpp b/ace/OS.cpp index a297e13fc10..4a398e51184 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -588,7 +588,7 @@ ace_thread_adapter (void *args) status = (*func) (arg); // Call thread entry point. } ACE_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) { - ACE_DEBUG ((LM_DEBUG, "(%t) Win32 structured exception exiting outermost svc_run\n")); + ACE_DEBUG ((LM_DEBUG, "(%t) Win32 structured exception exiting thread")); // Here's where we might want to provide a hook to report this... // As it stands now, we just catch all Win32 structured exceptions // so that we can make sure to clean up correctly when the thread diff --git a/ace/Parse_Node.h b/ace/Parse_Node.h index 9423a7d5af8..f3701a964ad 100644 --- a/ace/Parse_Node.h +++ b/ace/Parse_Node.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY diff --git a/ace/Service_Record.cpp b/ace/Service_Record.cpp index 63c7e5345c5..53271cf49a1 100644 --- a/ace/Service_Record.cpp +++ b/ace/Service_Record.cpp @@ -214,8 +214,11 @@ ACE_Stream_Type::fini (void) const { ACE_Module_Type *t = m->link (); - // Final 0 arg disables ACE_Module::DELETE_THIS - str->remove (m->name (), 0); + // Final arg is an indication to *not* delete the Module. + str->remove (m->name (), MT_Module::M_DELETE_NONE); + + // Finalize the Module (this may delete it, but we don't really + // care since we don't access it again). m->fini (); m = t; } @@ -235,12 +238,10 @@ ACE_Stream_Type::remove (ACE_Module_Type *mod) MT_Stream *str = (MT_Stream *) obj; int result = 0; - ACE_Module_Type *m = this->head_; - - while (m != 0) + for (ACE_Module_Type *m = this->head_; m != 0; ) { - ACE_Module_Type *next = m->link (); // We need to do this first so we don't bomb out if we delete m! + ACE_Module_Type *next = m->link (); if (m == mod) { @@ -249,10 +250,13 @@ ACE_Stream_Type::remove (ACE_Module_Type *mod) else prev->link (next); - // Final 0 arg disables ACE_Module::DELETE_THIS - if (str->remove (m->name (), 0) == -1) + // Final arg is an indication to *not* delete the Module. + if (str->remove (m->name (), MT_Module::M_DELETE_NONE) == -1) result = -1; - m->fini (); // This call may end up deleteing m! + + // This call may end up deleting m, which is ok since we + // don't access it again! + m->fini (); } else prev = m; @@ -280,7 +284,10 @@ ACE_Module_Type * ACE_Stream_Type::find (const char *mod_name) const { ACE_TRACE ("ACE_Stream_Type::find"); - for (ACE_Module_Type *m = this->head_; m != 0; m = m->link ()) + + for (ACE_Module_Type *m = this->head_; + m != 0; + m = m->link ()) if (ACE_OS::strcmp (m->name (), mod_name) == 0) return m; diff --git a/ace/Service_Record.h b/ace/Service_Record.h index 427969d2b04..f2ce2492c26 100644 --- a/ace/Service_Record.h +++ b/ace/Service_Record.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY diff --git a/ace/Stream.cpp b/ace/Stream.cpp index ab75f3b73d9..13a1874ed51 100644 --- a/ace/Stream.cpp +++ b/ace/Stream.cpp @@ -118,19 +118,21 @@ ACE_Stream::pop (int flags) else { // Skip over the ACE_Stream head. - ACE_Module *top = this->stream_head_->next (); - ACE_Module *new_top = top->next (); + ACE_Module *top_mod = this->stream_head_->next (); + ACE_Module *new_top = top_mod->next (); this->stream_head_->next (new_top); // Close the top ACE_Module. - top->close (flags); - delete top; + top_mod->close (flags); + + // Don't delete the Module unless the flags request this. + if (flags != ACE_Module::M_DELETE_NONE) + delete top_mod; this->stream_head_->writer ()->next (new_top->writer ()); new_top->reader ()->next (this->stream_head_->reader ()); - return 0; } } @@ -139,12 +141,15 @@ ACE_Stream::pop (int flags) // ACE_Stream. template int -ACE_Stream::remove (const char *name, int flags) +ACE_Stream::remove (const char *name, + int flags) { ACE_TRACE ("ACE_Stream::remove"); ACE_Module *prev = 0; - for (ACE_Module *mod = this->stream_head_; mod != 0; mod = mod->next ()) + for (ACE_Module *mod = this->stream_head_; + mod != 0; + mod = mod->next ()) if (ACE_OS::strcmp (mod->name (), name) == 0) { if (prev == 0) // Deleting ACE_Stream Head @@ -154,7 +159,11 @@ ACE_Stream::remove (const char *name, int flags) // Close down the module and release the memory. mod->close (flags); - delete mod; + + // Don't delete the Module unless the flags request this. + if (flags != ACE_Module::M_DELETE_NONE) + delete mod; + return 0; } else diff --git a/examples/Threads/task_two.cpp b/examples/Threads/task_two.cpp index 454b3a62adf..169107488f2 100644 --- a/examples/Threads/task_two.cpp +++ b/examples/Threads/task_two.cpp @@ -13,7 +13,7 @@ typedef ACE_Atomic_Op ATOMIC_INT; -static u_long zero = 0; +static int zero = 0; static ATOMIC_INT task_count (zero); static ATOMIC_INT max_count (zero); static ATOMIC_INT wait_count (zero); @@ -46,7 +46,7 @@ Task_Test::open (void *) task_count++; ACE_DEBUG ((LM_DEBUG, "(%t) creating Task_Test, task count = %d\n", - (u_long) task_count)); + (int) task_count)); return this->activate (THR_BOUND); } @@ -58,7 +58,7 @@ Task_Test::close (u_long) task_count--; ACE_DEBUG ((LM_DEBUG, "(%t) destroying Task_Test, task count = %d\n", - (u_long) task_count)); + (int) task_count)); wait_count--; // delete this; return 0; @@ -93,7 +93,7 @@ main (int argc, char *argv[]) for (int i = 1; i <= n_iterations; i++) { ACE_DEBUG ((LM_DEBUG, "(%t) iteration = %d, max_count %d\n", - i, (u_long) max_count)); + i, (int) max_count)); max_count = 0; ACE_DEBUG ((LM_DEBUG, "(%t) starting %d task%s\n", @@ -118,7 +118,7 @@ main (int argc, char *argv[]) ACE_Thread::yield (); ACE_DEBUG ((LM_DEBUG, "(%t) iteration %d finished, max_count %d, wait_count %d, waiting for tasks to exit\n", - i, (u_long) max_count, (u_long) wait_count)); + i, (int) max_count, (int) wait_count)); // Wait for all the tasks to exit. ACE_Service_Config::thr_mgr ()->wait (); diff --git a/netsvcs/ACE-netsvcs.html b/netsvcs/ACE-netsvcs.html index ee0dc874af6..6a3998fbc6b 100644 --- a/netsvcs/ACE-netsvcs.html +++ b/netsvcs/ACE-netsvcs.html @@ -50,8 +50,9 @@ Configurator, which is an object-oriented framework that automates the configuration and reconfiguration of multi-service daemons. All the ACE network services are configured using the Service Configurator. Please refer to the online documentation for more -information on installing and testing the ACE network services.

    +HREF="http://www.cs.wustl.edu/~schmidt/ACE-INSTALL.html">online +documentation for more information on installing and testing the +ACE network services.


    -- cgit v1.2.1