diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-11-30 00:33:43 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-11-30 00:33:43 +0000 |
commit | 8ca31fd725b7bd02f2038a5b3a03c3da64b6b48c (patch) | |
tree | dd496dde3c016a1db5d3882e1dc40c9af7e9aaf8 /ace | |
parent | 42f04951935318cb83949862c4abd11a8386cc91 (diff) | |
download | ATCD-8ca31fd725b7bd02f2038a5b3a03c3da64b6b48c.tar.gz |
Eon
Diffstat (limited to 'ace')
99 files changed, 297 insertions, 412 deletions
diff --git a/ace/ACE.i b/ace/ACE.i index 7319faecd1d..8d00aed2d7c 100644 --- a/ace/ACE.i +++ b/ace/ACE.i @@ -2,8 +2,6 @@ // $Id$ // ACE.i -#include "ace/Log_Msg.h" - // Miscellaneous static methods used throughout ACE. inline ssize_t diff --git a/ace/ARGV.cpp b/ace/ARGV.cpp index 184b9c96ad5..50ea455063e 100644 --- a/ace/ARGV.cpp +++ b/ace/ARGV.cpp @@ -4,7 +4,6 @@ // Transforms a string BUF into an ARGV-style vector of strings. #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/ARGV.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Addr.cpp b/ace/Addr.cpp index 39edb5fe6d2..d7671801956 100644 --- a/ace/Addr.cpp +++ b/ace/Addr.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Addr.h" // This is a static class variable. diff --git a/ace/CORBA_Handler.cpp b/ace/CORBA_Handler.cpp index 2c91d534caa..98af56bd02d 100644 --- a/ace/CORBA_Handler.cpp +++ b/ace/CORBA_Handler.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/CORBA_Handler.h" #if !defined (__ACE_INLINE__) diff --git a/ace/DEV_Addr.cpp b/ace/DEV_Addr.cpp index 01833806e62..de93fb655e3 100644 --- a/ace/DEV_Addr.cpp +++ b/ace/DEV_Addr.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/DEV_Addr.h" #if !defined (__ACE_INLINE__) diff --git a/ace/DEV_Connector.i b/ace/DEV_Connector.i index 14e3f988137..bc3b10f0f08 100644 --- a/ace/DEV_Connector.i +++ b/ace/DEV_Connector.i @@ -3,8 +3,6 @@ // DEV_Connector.i -#include "ace/Log_Msg.h" - // Creates a Local ACE_DEV. inline diff --git a/ace/DEV_IO.cpp b/ace/DEV_IO.cpp index 52b077a3ad3..afa9a947c04 100644 --- a/ace/DEV_IO.cpp +++ b/ace/DEV_IO.cpp @@ -3,7 +3,6 @@ #define ACE_BUILD_DLL #include "ace/DEV_IO.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_DEV_IO) diff --git a/ace/FIFO.i b/ace/FIFO.i index be1481b954a..d5aa8fb1943 100644 --- a/ace/FIFO.i +++ b/ace/FIFO.i @@ -3,8 +3,6 @@ // FIFO.i -#include "ace/Log_Msg.h" - ACE_INLINE int ACE_FIFO::get_local_addr (const char *&r) const { diff --git a/ace/FIFO_Recv.cpp b/ace/FIFO_Recv.cpp index ff05686d6a1..3add4e66072 100644 --- a/ace/FIFO_Recv.cpp +++ b/ace/FIFO_Recv.cpp @@ -5,7 +5,6 @@ #define ACE_BUILD_DLL #include "ace/FIFO_Recv.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv) diff --git a/ace/FIFO_Recv_Msg.cpp b/ace/FIFO_Recv_Msg.cpp index 002efd735a9..f2712048c08 100644 --- a/ace/FIFO_Recv_Msg.cpp +++ b/ace/FIFO_Recv_Msg.cpp @@ -5,7 +5,6 @@ #define ACE_BUILD_DLL #include "ace/FIFO_Recv_Msg.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg) diff --git a/ace/FIFO_Send.cpp b/ace/FIFO_Send.cpp index 6d463af5ae8..61280a590a9 100644 --- a/ace/FIFO_Send.cpp +++ b/ace/FIFO_Send.cpp @@ -5,7 +5,6 @@ #define ACE_BUILD_DLL #include "ace/FIFO_Send.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send) diff --git a/ace/FIFO_Send_Msg.cpp b/ace/FIFO_Send_Msg.cpp index 88848c779ca..1119f979851 100644 --- a/ace/FIFO_Send_Msg.cpp +++ b/ace/FIFO_Send_Msg.cpp @@ -5,7 +5,6 @@ #define ACE_BUILD_DLL #include "ace/FIFO_Send_Msg.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg) diff --git a/ace/FILE_Addr.cpp b/ace/FILE_Addr.cpp index 3ff02900990..4d7c06f4553 100644 --- a/ace/FILE_Addr.cpp +++ b/ace/FILE_Addr.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/FILE_Addr.h" #if !defined (__ACE_INLINE__) diff --git a/ace/FILE_Connector.i b/ace/FILE_Connector.i index 14e8d809a68..b8b0cf0e3be 100644 --- a/ace/FILE_Connector.i +++ b/ace/FILE_Connector.i @@ -3,8 +3,6 @@ // FILE_Connector.i -#include "ace/Log_Msg.h" - // Creates a Local ACE_FILE. inline diff --git a/ace/FILE_IO.cpp b/ace/FILE_IO.cpp index b77bcaf98fc..6f2c57fe50a 100644 --- a/ace/FILE_IO.cpp +++ b/ace/FILE_IO.cpp @@ -1,10 +1,8 @@ // FILE_IO.cpp // $Id$ - #define ACE_BUILD_DLL #include "ace/FILE_IO.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_FILE_IO) diff --git a/ace/Get_Opt.cpp b/ace/Get_Opt.cpp index 5f66fc1ee09..d526eb36475 100644 --- a/ace/Get_Opt.cpp +++ b/ace/Get_Opt.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Get_Opt.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Handle_Set.cpp b/ace/Handle_Set.cpp index 4a6140a8cd8..b0258da7476 100644 --- a/ace/Handle_Set.cpp +++ b/ace/Handle_Set.cpp @@ -1,10 +1,7 @@ // Handle_Set.cpp // $Id$ -/* Wrapper for the ACE_HANDLE set abstraction. */ - #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Handle_Set.h" #if !defined (__ACE_INLINE__) diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp index aad19e26799..c345c407ec9 100644 --- a/ace/High_Res_Timer.cpp +++ b/ace/High_Res_Timer.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/High_Res_Timer.h" #if !defined (__ACE_INLINE__) diff --git a/ace/INET_Addr.i b/ace/INET_Addr.i index 81a5fa3dc6f..ebeefaca31c 100644 --- a/ace/INET_Addr.i +++ b/ace/INET_Addr.i @@ -3,8 +3,6 @@ // INET_Addr.i -#include "ace/Log_Msg.h" - // Return the port number, converting it into host byte order... ACE_INLINE u_short diff --git a/ace/IO_SAP.cpp b/ace/IO_SAP.cpp index d6fbaca169d..f53cd71f292 100644 --- a/ace/IO_SAP.cpp +++ b/ace/IO_SAP.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/IO_SAP.h" ACE_ALLOC_HOOK_DEFINE(ACE_IO_SAP) diff --git a/ace/IPC_SAP.cpp b/ace/IPC_SAP.cpp index 74d914d1c4f..52b2a19c8bb 100644 --- a/ace/IPC_SAP.cpp +++ b/ace/IPC_SAP.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/IPC_SAP.h" ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP) diff --git a/ace/LSOCK.cpp b/ace/LSOCK.cpp index 8b60716ef46..add2fe3851f 100644 --- a/ace/LSOCK.cpp +++ b/ace/LSOCK.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/LSOCK.h" #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) diff --git a/ace/LSOCK_Acceptor.cpp b/ace/LSOCK_Acceptor.cpp index db8c374d519..e3adf489576 100644 --- a/ace/LSOCK_Acceptor.cpp +++ b/ace/LSOCK_Acceptor.cpp @@ -1,9 +1,7 @@ // LSOCK_Acceptor.cpp // $Id$ - #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/LSOCK_Acceptor.h" #if !defined (__ACE_INLINE__) diff --git a/ace/LSOCK_CODgram.cpp b/ace/LSOCK_CODgram.cpp index f2c357ebd0d..7fa0d7f43dc 100644 --- a/ace/LSOCK_CODgram.cpp +++ b/ace/LSOCK_CODgram.cpp @@ -1,12 +1,8 @@ // LSOCK_CODgram.cpp // $Id$ -/* Contains the definitions for the Local ACE_SOCK connection-oriented - datagram abstraction. */ - #define ACE_BUILD_DLL #include "ace/LSOCK_CODgram.h" -#include "ace/Log_Msg.h" #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) diff --git a/ace/LSOCK_Dgram.cpp b/ace/LSOCK_Dgram.cpp index 621cebbdaf5..7699b1f1e8b 100644 --- a/ace/LSOCK_Dgram.cpp +++ b/ace/LSOCK_Dgram.cpp @@ -1,12 +1,8 @@ // LSOCK_Dgram.cpp // $Id$ -/* Defines the member functions for the Local ACE_SOCK datagram - abstraction. */ - #define ACE_BUILD_DLL #include "ace/LSOCK_Dgram.h" -#include "ace/Log_Msg.h" #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) diff --git a/ace/LSOCK_Stream.cpp b/ace/LSOCK_Stream.cpp index 108401fc1a1..e79927e3100 100644 --- a/ace/LSOCK_Stream.cpp +++ b/ace/LSOCK_Stream.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/LSOCK_Stream.h" #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp index ec5b8365919..945b0b999bb 100644 --- a/ace/Local_Name_Space.cpp +++ b/ace/Local_Name_Space.cpp @@ -5,7 +5,6 @@ #define ACE_LOCAL_NAME_SPACE_C #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/ACE.h" #include "ace/Local_Name_Space.h" diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index ae9bb088d37..753737296b1 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -5,7 +5,6 @@ #define ACE_LOCAL_NAME_SPACE_T_C #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/ACE.h" #include "ace/Local_Name_Space.h" diff --git a/ace/Local_Tokens.cpp b/ace/Local_Tokens.cpp index f928de4c6a0..0496c02c2e3 100644 --- a/ace/Local_Tokens.cpp +++ b/ace/Local_Tokens.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Thread.h" #include "ace/Local_Tokens.h" #include "ace/Token_Manager.h" diff --git a/ace/Local_Tokens_T.cpp b/ace/Local_Tokens_T.cpp index da978100488..c28e62feb31 100644 --- a/ace/Local_Tokens_T.cpp +++ b/ace/Local_Tokens_T.cpp @@ -5,7 +5,6 @@ #define ACE_LOCAL_TOKENS_T_C #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Local_Tokens_T.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index 042a450203f..19b2784e73e 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -23,7 +23,6 @@ #include "ace/Thread.h" #include "ace/Synch.h" -#include "ace/Log_Msg.h" #if defined (ACE_HAS_UNICODE) #define ACE_WSPRINTF(BUF,VALUE) ::wsprintf (BUF, "%S", VALUE) diff --git a/ace/Log_Priority.h b/ace/Log_Priority.h index 26b2a5f64d6..f8c9c0eda65 100644 --- a/ace/Log_Priority.h +++ b/ace/Log_Priority.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp index 7e1e1388e93..075372c1013 100644 --- a/ace/Log_Record.cpp +++ b/ace/Log_Record.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Log_Record.h" ACE_ALLOC_HOOK_DEFINE(ACE_Log_Record) diff --git a/ace/Log_Record.h b/ace/Log_Record.h index 84685fb7d96..5a19ddc2d03 100644 --- a/ace/Log_Record.h +++ b/ace/Log_Record.h @@ -14,18 +14,19 @@ // // ============================================================================ -#if !defined (ACE_LM_RECORD_H) -#define ACE_LM_RECORD_H - -#include "ace/ACE.h" +// These need to go outside of the #ifdef to avoid problems with +// circular dependencies... #include "ace/Log_Priority.h" +#include "ace/ACE.h" + +#if !defined (ACE_LOG_RECORD_H) +#define ACE_LOG_RECORD_H class ACE_Export ACE_Log_Record { // = TITLE // Defines the structure of an ACE logging record. public: -friend ostream &operator << (ostream &, ACE_Log_Record &); enum { MAXLOGMSGLEN = BUFSIZ * 4, @@ -134,4 +135,4 @@ private: }; #include "ace/Log_Record.i" -#endif /* ACE_LM_Record_H */ +#endif /* ACE_LOG_RECORD_H */ diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h index 37ba9ab7a21..a36b0b006c6 100644 --- a/ace/Malloc_T.h +++ b/ace/Malloc_T.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -19,7 +18,6 @@ #define ACE_MALLOC_T_H #include "ace/ACE.h" -#include "ace/Log_Msg.h" #include "ace/Synch.h" #include "ace/Malloc.h" diff --git a/ace/Map_Manager.cpp b/ace/Map_Manager.cpp index 15651326e20..c448a61362c 100644 --- a/ace/Map_Manager.cpp +++ b/ace/Map_Manager.cpp @@ -5,7 +5,6 @@ #define ACE_MAP_MANAGER_C #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Synch.h" #include "ace/Malloc.h" #include "ace/Service_Config.h" diff --git a/ace/Mem_Map.i b/ace/Mem_Map.i index ecba43e127d..62b3cd6daa6 100644 --- a/ace/Mem_Map.i +++ b/ace/Mem_Map.i @@ -3,8 +3,6 @@ // Mem_Map.i -#include "ace/Log_Msg.h" - ACE_INLINE ACE_HANDLE ACE_Mem_Map::handle (void) const { diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp index 7148c4c7a5f..aebceed532a 100644 --- a/ace/Memory_Pool.cpp +++ b/ace/Memory_Pool.cpp @@ -3,7 +3,6 @@ // Memory_Pool.cpp #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Memory_Pool.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 5c0947f806a..9f9503ef429 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Message_Block.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Message_Block.i b/ace/Message_Block.i index ee7f50939b8..eebe94937d6 100644 --- a/ace/Message_Block.i +++ b/ace/Message_Block.i @@ -3,8 +3,6 @@ // Message_Block.i -#include "ace/Log_Msg.h" - ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::set_flags (ACE_Message_Block::Message_Flags more_flags) { diff --git a/ace/Message_Queue.i b/ace/Message_Queue.i index 8ebcdf0fd79..7661fb826c7 100644 --- a/ace/Message_Queue.i +++ b/ace/Message_Queue.i @@ -3,8 +3,6 @@ // Message_Queue.i -#include "ace/Log_Msg.h" - // Check if queue is empty (does not hold locks). template <ACE_SYNCH_1> ACE_INLINE int diff --git a/ace/Module.cpp b/ace/Module.cpp index 9471de5cc8e..35db70ee7ac 100644 --- a/ace/Module.cpp +++ b/ace/Module.cpp @@ -109,8 +109,10 @@ template <ACE_SYNCH_1> ACE_INLINE ACE_Module<ACE_SYNCH_2>::~ACE_Module (void) { ACE_TRACE ("ACE_Module<ACE_SYNCH_2>::~ACE_Module"); - ACE_ERROR ((LM_ERROR, "destructor for %s should never be called!\n", - this->name ())); + + // Only close down if we haven't already done so. + if (this->reader () != 0 || this->writer () != 0) + this->close (); } template <ACE_SYNCH_1> ACE_INLINE @@ -154,14 +156,14 @@ ACE_Module<ACE_SYNCH_2>::close (u_long flags) // running in them. if (reader_q->thr_count () == 0) delete reader_q; - this->reader (0); - if (writer_q->thr_count () == 0) delete writer_q; - this->writer (0); - - delete (void *) this; // Darn well better be allocated dynamically!!! } + + // Set the reader and writers to NULL so that we don't try to close() + // this object again if the destructor gets called. + this->reader (0); + this->writer (0); return result; } diff --git a/ace/Module.h b/ace/Module.h index 3f505121166..6f459afeb5f 100644 --- a/ace/Module.h +++ b/ace/Module.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -47,6 +46,9 @@ public: ACE_Module (void); // Create an empty Module. + ~ACE_Module (void); + // Shutdown the Module. + ACE_Module (const char *module_name, ACE_Task<ACE_SYNCH_2> *writer = 0, ACE_Task<ACE_SYNCH_2> *reader = 0, @@ -108,9 +110,6 @@ public: // Declare the dynamic allocation hooks. private: - ~ACE_Module (void); - // *Must* use dynamic allocation. - ACE_Task<ACE_SYNCH_2> *q_pair_[2]; // Pair of Tasks that form the "read-side" and "write-side" of the // ACE_Module partitioning. diff --git a/ace/Name_Proxy.cpp b/ace/Name_Proxy.cpp index dadc2580b76..02dc399a219 100644 --- a/ace/Name_Proxy.cpp +++ b/ace/Name_Proxy.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Name_Proxy.h" void diff --git a/ace/Name_Request_Reply.cpp b/ace/Name_Request_Reply.cpp index 804ae6ce89d..cd7460626c3 100644 --- a/ace/Name_Request_Reply.cpp +++ b/ace/Name_Request_Reply.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Name_Request_Reply.h" // Default "do nothing" constructor. diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index f124b96a08c..ae4b4e1673b 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Get_Opt.h" #include "ace/Naming_Context.h" #include "ace/Remote_Name_Space.h" diff --git a/ace/OS.cpp b/ace/OS.cpp index b52c155fe99..45f838530c5 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -4,7 +4,6 @@ #define ACE_BUILD_DLL #include "ace/OS.h" -#include "ace/Log_Msg.h" #include "ace/ARGV.h" // Perhaps we should *always* include ace/OS.i in order to make sure @@ -153,24 +153,6 @@ #define ACE_SET_BITS(WORD, BITS) (WORD |= (BITS)) #define ACE_CLR_BITS(WORD, BITS) (WORD &= ~(BITS)) -// A useful abstraction for expressions involving operator new since -// we can change memory allocation error handling policies (e.g., -// depending on whether ANSI/ISO exception handling semantics are -// being used). - -#if 0 - else if (ACE_LOG_MSG->op_status () == -1) { \ - errno = ACE_LOG_MSG->errnum (); \ - delete POINTER; POINTER = 0; return; -#endif /* 0 */ - -#define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return; }} while (0) -#define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return RET_VAL; }} while (0) - // These hooks enable ACE to have all dynamic memory management // automatically handled on a per-object basis. @@ -906,8 +888,8 @@ typedef void (*ACE_SignalHandlerV)(...); typedef void (*ACE_SignalHandler)(int, ...); typedef void (*ACE_SignalHandlerV)(int,...); #elif defined (ACE_HAS_SUNOS4_SIGNAL_T) -typedef void (*ACE_SignalHandler)(void); -typedef void (*ACE_SignalHandlerV)(void); +typedef void (*ACE_SignalHandler)(...); +typedef void (*ACE_SignalHandlerV)(...); #elif defined (ACE_HAS_SVR4_SIGNAL_T) // SVR4 Signals are inconsistent (e.g., see struct sigaction).. typedef void (*ACE_SignalHandler)(int); @@ -2344,6 +2326,44 @@ private: #include "ace/Trace.h" +// These need to come here to avoid problems with circular dependencies. +#include "ace/Log_Msg.h" + +// A useful abstraction for expressions involving operator new since +// we can change memory allocation error handling policies (e.g., +// depending on whether ANSI/ISO exception handling semantics are +// being used). + +#define ACE_NEW(POINTER,CONSTRUCTOR) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; return; } \ + else if (ACE_LOG_MSG->op_status () == -1) { \ + int ace_error = ACE_LOG_MSG->errnum (); \ + delete POINTER; POINTER = 0; \ + ACE_LOG_MSG->op_status (-1); \ + errno = ace_error; return; \ + } } while (0) +#define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ + else if (ACE_LOG_MSG->op_status () == -1) { \ + int ace_error = ACE_LOG_MSG->errnum (); \ + delete POINTER; POINTER = 0; \ + ACE_LOG_MSG->op_status (-1); \ + errno = ace_error; return RET_VAL; \ + } } while (0) + +#if 0 +#define ACE_NEW(POINTER,CONSTRUCTOR) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) errno = ENOMEM; \ + return; } while (0) +#define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ + else return POINTER; } while (0) +#endif + #if defined (ACE_HAS_INLINED_OSCALLS) #if defined (ACE_INLINE) #undef ACE_INLINE @@ -168,7 +168,6 @@ extern "C" void ace_mutex_lock_cleanup_adapter (void *args); #endif /* VXWORKS */ #if defined (ACE_HAS_SIGNAL_SAFE_OS_CALLS) -#include "ace/Log_Msg.h" // The following two macros ensure that system calls are properly // restarted (if necessary) when interrupts occur. #define ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT) \ @@ -995,40 +994,6 @@ ACE_OS::thread_mutex_unlock (ACE_thread_mutex_t *m) } ACE_INLINE int -ACE_OS::cond_broadcast (ACE_cond_t *cv) -{ -// ACE_TRACE ("ACE_OS::cond_broadcast"); -#if defined (ACE_HAS_THREADS) -#if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_broadcast (cv), - ace_result_), - int, -1); -#elif defined (ACE_HAS_STHREADS) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_broadcast (cv), - ace_result_), - int, -1); -#elif defined (ACE_HAS_WTHREADS) || defined (VXWORKS) - int result = 0; - int error = 0; - - for (int i = cv->waiters_; i > 0; i--) - if (ACE_OS::sema_post (&cv->sema_) != 0) - { - error = errno; - result = -1; - break; - } - - errno = error; - return result; -#endif /* ACE_HAS_STHREADS */ -#else - cv = cv; - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ -} - -ACE_INLINE int ACE_OS::cond_destroy (ACE_cond_t *cv) { // ACE_TRACE ("ACE_OS::cond_destroy"); @@ -1124,6 +1089,107 @@ ACE_OS::cond_signal (ACE_cond_t *cv) } ACE_INLINE int +ACE_OS::cond_broadcast (ACE_cond_t *cv) +{ +// ACE_TRACE ("ACE_OS::cond_broadcast"); +#if defined (ACE_HAS_THREADS) +#if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_broadcast (cv), + ace_result_), + int, -1); +#elif defined (ACE_HAS_STHREADS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_broadcast (cv), + ace_result_), + int, -1); +#elif defined (ACE_HAS_WTHREADS) || defined (VXWORKS) + // The <external_mutex> must be locked before this call is made. + + int result = 0; + int error = 0; + + // Keep track of the number of waiters. + // cv->signaled_waiters_ = cv->waiters_; + // ACE_OS::sema_init (cv->signaled_counter_, cv->signaled_waiters_); + + // Wake up all the waiters. + + for (int i = cv->waiters_; i > 0; i--) + if (ACE_OS::sema_post (&cv->sema_) != 0) + { + error = errno; + result = -1; + break; + } + + // Wait for all the awakened threads to acquire their part of the + // counting semaphore. + // ::WaitForSingleObject (cv->waiters_done_, INFINITE); + // ACE_OS::sema_destroy (cv->signaled_counter_); + errno = error; + return result; +#endif /* ACE_HAS_STHREADS */ +#else + cv = cv; + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_THREADS */ +} + +ACE_INLINE int +ACE_OS::cond_wait (ACE_cond_t *cv, + ACE_mutex_t *external_mutex) +{ +// ACE_TRACE ("ACE_OS::cond_wait"); +#if defined (ACE_HAS_THREADS) +#if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_wait (cv, external_mutex), ace_result_), + int, -1); +#elif defined (ACE_HAS_STHREADS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_wait (cv, external_mutex), ace_result_), + int, -1); +#elif defined (ACE_HAS_WTHREADS) || defined (VXWORKS) + // It's ok to increment this because the <external_mutex> is locked. + cv->waiters_++; + + if (ACE_OS::mutex_unlock (external_mutex) != 0) + return -1; + + int result = 0; + int error = 0; + + // Wait to be awakened by a ACE_OS::signal() or ACE_OS::broadcast(). + if (ACE_OS::sema_wait (&cv->sema_) != 0) + { + result = -1; + error = errno; + } + + // ACE_OS::sema_wait (cv->signaled_counter_); + // ACE_OS::mutex_lock (cv->internal_mutex_); + // cv->signaled_waiters_--; + // Release the signaler. + // if (cv->signaled_waiters_ == 0) + // ::SetEvent (cv->waiters_done_); + // ACE_OS::mutex_unlock (cv->internal_mutex_); + + // We must always regain the mutex, even when errors occur so that + // we can atomically decrement the count of the waiters. + ACE_OS::mutex_lock (external_mutex); + + // By making the waiter responsible for decrementing its count we + // don't have to worry about having an internal mutex. Thanks to + // Karlheinz for recognizing this optimization. + cv->waiters_--; + + // Reset errno in case mutex_lock() also fails... + errno = error; + return result; +#endif /* ACE_HAS_STHREADS */ +#else + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_THREADS */ +} + +ACE_INLINE int ACE_OS::cond_timedwait (ACE_cond_t *cv, ACE_mutex_t *external_mutex, ACE_Time_Value *timeout) @@ -1212,53 +1278,6 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, #endif /* ACE_HAS_THREADS */ } -ACE_INLINE int -ACE_OS::cond_wait (ACE_cond_t *cv, - ACE_mutex_t *external_mutex) -{ -// ACE_TRACE ("ACE_OS::cond_wait"); -#if defined (ACE_HAS_THREADS) -#if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_wait (cv, external_mutex), ace_result_), - int, -1); -#elif defined (ACE_HAS_STHREADS) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_wait (cv, external_mutex), ace_result_), - int, -1); -#elif defined (ACE_HAS_WTHREADS) || defined (VXWORKS) - // Note that it is ok to increment this because the <external_mutex> - // is locked. - cv->waiters_++; - - if (ACE_OS::mutex_unlock (external_mutex) != 0) - return -1; - - int result = 0; - int error = 0; - - if (ACE_OS::sema_wait (&cv->sema_) != 0) - { - result = -1; - error = errno; - } - - // We must always regain the mutex, even when errors occur so that - // we can atomically decrement the count of the waiters. - ACE_OS::mutex_lock (external_mutex); - - // By making the waiter responsible for decrementing its count we - // don't have to worry about having an internal mutex. Thanks to - // Karlheinz for recognizing this optimization. - cv->waiters_--; - - // Reset errno in case mutex_lock() also fails... - errno = error; - return result; -#endif /* ACE_HAS_STHREADS */ -#else - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ -} - #if defined (ACE_WIN32) ACE_INLINE int ACE_OS::cond_timedwait (ACE_cond_t *cv, diff --git a/ace/Pipe.cpp b/ace/Pipe.cpp index faa8c2ba993..7f5c234e224 100644 --- a/ace/Pipe.cpp +++ b/ace/Pipe.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/Pipe.h" diff --git a/ace/Process_Manager.h b/ace/Process_Manager.h index 79d8c3b9c3d..b2557e2522f 100644 --- a/ace/Process_Manager.h +++ b/ace/Process_Manager.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -18,7 +17,6 @@ #if !defined (ACE_PROCESS_MANAGER_H) #define ACE_PROCESS_MANAGER_H -#include "ace/Log_Msg.h" #include "ace/Synch.h" #if 0 diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index 3572ffea70f..30b8a5b868d 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Synch_T.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" diff --git a/ace/Reactor.i b/ace/Reactor.i index 519b3fadccf..7b7e38218ec 100644 --- a/ace/Reactor.i +++ b/ace/Reactor.i @@ -3,8 +3,6 @@ // Reactor.i -#include "ace/Log_Msg.h" - inline int ACE_Reactor::resume_handler (ACE_Event_Handler *h) { diff --git a/ace/Remote_Name_Space.cpp b/ace/Remote_Name_Space.cpp index 9125b4e47a7..cc9f42041dd 100644 --- a/ace/Remote_Name_Space.cpp +++ b/ace/Remote_Name_Space.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Remote_Name_Space.h" int diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp index 743eb593c64..b8efd348746 100644 --- a/ace/Remote_Tokens.cpp +++ b/ace/Remote_Tokens.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Remote_Tokens.h" #include "ace/Singleton.h" diff --git a/ace/SOCK.cpp b/ace/SOCK.cpp index 251e9e71eac..27886121f90 100644 --- a/ace/SOCK.cpp +++ b/ace/SOCK.cpp @@ -3,7 +3,6 @@ #define ACE_BUILD_DLL #include "ace/SOCK.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_SOCK) diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp index 1a1e05fe536..0081bcc1f28 100644 --- a/ace/SOCK_Acceptor.cpp +++ b/ace/SOCK_Acceptor.cpp @@ -3,7 +3,6 @@ #define ACE_BUILD_DLL #include "ace/SOCK_Acceptor.h" -#include "ace/Log_Msg.h" #if !defined (__ACE_INLINE__) #include "ace/SOCK_Acceptor.i" diff --git a/ace/SOCK_Acceptor.i b/ace/SOCK_Acceptor.i index 06b6b01401c..03d9f211645 100644 --- a/ace/SOCK_Acceptor.i +++ b/ace/SOCK_Acceptor.i @@ -3,6 +3,5 @@ // SOCK_Acceptor.i -#include "ace/Log_Msg.h" diff --git a/ace/SOCK_CODgram.cpp b/ace/SOCK_CODgram.cpp index c8c4d88a6f7..14c12f2e3c6 100644 --- a/ace/SOCK_CODgram.cpp +++ b/ace/SOCK_CODgram.cpp @@ -1,12 +1,8 @@ // SOCK_CODgram.cpp // $Id$ -/* Contains the definitions for the ACE_SOCK connection-oriented - datagram abstraction. */ - #define ACE_BUILD_DLL #include "ace/SOCK_CODgram.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_CODgram) @@ -16,7 +12,7 @@ ACE_SOCK_CODgram::dump (void) const ACE_TRACE ("ACE_SOCK_CODgram::dump"); } -/* Here's the general-purpose constructor. */ +// Here's the general-purpose constructor. ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &local, int protocol_family, int protocol) @@ -60,28 +56,28 @@ ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local, if (&local == &ACE_Addr::sap_any && &remote == &ACE_Addr::sap_any) { - /* Assign an arbitrary port number from the transient range!! */ + // Assign an arbitrary port number from the transient range!! if (protocol_family == PF_INET && ACE::bind_port (this->get_handle ()) == -1) error = 1; } - /* We are binding just the local address. */ + // We are binding just the local address. else if (&local != &ACE_Addr::sap_any && &remote == &ACE_Addr::sap_any) { if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), local.get_size ()) == -1) error = 1; } - /* We are connecting to the remote address. */ + // We are connecting to the remote address. else if (&local == &ACE_Addr::sap_any && &remote != &ACE_Addr::sap_any) { if (ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), remote.get_size ()) == -1) error = 1; } - /* We are binding to the local address and connecting to the - remote addresses. */ + // We are binding to the local address and connecting to the + // remote addresses. else { if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), diff --git a/ace/SOCK_Connector.i b/ace/SOCK_Connector.i index 391e2146e14..93618bf464d 100644 --- a/ace/SOCK_Connector.i +++ b/ace/SOCK_Connector.i @@ -3,8 +3,6 @@ // SOCK_Connector.i -#include "ace/Log_Msg.h" - // This constructor is used by a client when it wants to connect to // the specified REMOTE_SAP address using a blocking open. diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp index 0df5119b560..3e982039052 100644 --- a/ace/SOCK_Dgram.cpp +++ b/ace/SOCK_Dgram.cpp @@ -4,7 +4,6 @@ #define ACE_BUILD_DLL #include "ace/SOCK_Dgram.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram) diff --git a/ace/SOCK_Dgram_Bcast.cpp b/ace/SOCK_Dgram_Bcast.cpp index aace0c07b60..641bb3788c7 100644 --- a/ace/SOCK_Dgram_Bcast.cpp +++ b/ace/SOCK_Dgram_Bcast.cpp @@ -4,7 +4,6 @@ #define ACE_BUILD_DLL #include "ace/SOCK_Dgram_Bcast.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram_Bcast) diff --git a/ace/SPIPE_Acceptor.cpp b/ace/SPIPE_Acceptor.cpp index 2597aa64b4d..4797d2087be 100644 --- a/ace/SPIPE_Acceptor.cpp +++ b/ace/SPIPE_Acceptor.cpp @@ -3,7 +3,6 @@ #define ACE_BUILD_DLL #include "ace/SPIPE_Acceptor.h" -#include "ace/Log_Msg.h" ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (void) { diff --git a/ace/SPIPE_Connector.i b/ace/SPIPE_Connector.i index cdbc69f06b2..33eeed7bc93 100644 --- a/ace/SPIPE_Connector.i +++ b/ace/SPIPE_Connector.i @@ -3,5 +3,4 @@ // SPIPE_Connector.i -#include "ace/Log_Msg.h" diff --git a/ace/SV_Message_Queue.cpp b/ace/SV_Message_Queue.cpp index 0350904392b..1a77d462280 100644 --- a/ace/SV_Message_Queue.cpp +++ b/ace/SV_Message_Queue.cpp @@ -3,7 +3,6 @@ #define ACE_BUILD_DLL #include "ace/SV_Message_Queue.h" -#include "ace/Log_Msg.h" ACE_ALLOC_HOOK_DEFINE(ACE_SV_Message_Queue) diff --git a/ace/SV_Semaphore_Complex.cpp b/ace/SV_Semaphore_Complex.cpp index 1586c7fb8a9..776907705f3 100644 --- a/ace/SV_Semaphore_Complex.cpp +++ b/ace/SV_Semaphore_Complex.cpp @@ -4,7 +4,6 @@ /* -*- C++ -*- */ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/SV_Semaphore_Complex.h" ACE_ALLOC_HOOK_DEFINE(ACE_SV_Semaphore_Complex) diff --git a/ace/SV_Semaphore_Simple.cpp b/ace/SV_Semaphore_Simple.cpp index 6ae67ea116d..bc4e92787d8 100644 --- a/ace/SV_Semaphore_Simple.cpp +++ b/ace/SV_Semaphore_Simple.cpp @@ -4,7 +4,6 @@ /* -*- C++ -*- */ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/SV_Semaphore_Simple.h" ACE_ALLOC_HOOK_DEFINE(ACE_SV_Semaphore_Simple) diff --git a/ace/SV_Shared_Memory.cpp b/ace/SV_Shared_Memory.cpp index 76a70f93b24..a8d0f13f286 100644 --- a/ace/SV_Shared_Memory.cpp +++ b/ace/SV_Shared_Memory.cpp @@ -3,7 +3,6 @@ #define ACE_BUILD_DLL #include "ace/SV_Shared_Memory.h" -#include "ace/Log_Msg.h" #if !defined (__ACE_INLINE__) #include "ace/SV_Shared_Memory.i" diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 1b231422402..6d87235f2c4 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -519,7 +519,7 @@ ACE_Service_Config::load_defaults (void) if (stp == 0) continue; - const ACE_Service_Record *sr; + ACE_Service_Record *sr; ACE_NEW_RETURN (sr, ACE_Service_Record (ssd->name_, stp, 0, ssd->active_), -1); diff --git a/ace/Service_Object.h b/ace/Service_Object.h index 32624e21a4e..f06fc88ffb4 100644 --- a/ace/Service_Object.h +++ b/ace/Service_Object.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -20,7 +19,6 @@ #include "ace/Shared_Object.h" #include "ace/Event_Handler.h" -#include "ace/Log_Msg.h" class ACE_Export ACE_Service_Object : public ACE_Event_Handler, public ACE_Shared_Object // = TITLE diff --git a/ace/Signal.cpp b/ace/Signal.cpp index 2354ec34a19..a9a5957fe29 100644 --- a/ace/Signal.cpp +++ b/ace/Signal.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Signal.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Singleton.cpp b/ace/Singleton.cpp index 4a07aedb70c..5d6a6e8ea31 100644 --- a/ace/Singleton.cpp +++ b/ace/Singleton.cpp @@ -44,25 +44,7 @@ ACE_Singleton<TYPE, LOCK>::instance (void) ACE_GUARD_RETURN (LOCK, ace_mon, ace_singleton_lock_, 0); if (instance_ == 0) - { - // We can replace the following lines with this line once we - // update the macro in OS.h - // ACE_NEW_RETURN (instance_, TYPE, 0); - - instance_ = new TYPE; - if (instance_ == 0) - { - errno = ENOMEM; - return 0; - } - else if (ACE_LOG_MSG->op_status () == -1) - { - errno = ACE_LOG_MSG->errnum (); - delete instance_; - instance_ = 0; - return 0; - } - } + ACE_NEW_RETURN (instance_, TYPE, 0); } return instance_; @@ -74,25 +56,7 @@ ACE_Singleton<TYPE, LOCK>::instance (void) ACE_GUARD_RETURN (LOCK, ace_mon, (ACE_Singleton<TYPE, LOCK>::ace_singleton_lock_), 0); if (ACE_Singleton<TYPE, LOCK>::instance_ == 0) - { - // We can replace the following lines with this line once we - // update the macro in OS.h - // ACE_NEW_RETURN ((ACE_Singleton<TYPE, LOCK>::instance_), TYPE, 0); - - instance_ = new TYPE; - if (instance_ == 0) - { - errno = ENOMEM; - return 0; - } - else if (ACE_LOG_MSG->op_status () == -1) - { - errno = ACE_LOG_MSG->errnum (); - delete instance_; - instance_ = 0; - return 0; - } - } + ACE_NEW_RETURN ((ACE_Singleton<TYPE, LOCK>::instance_), TYPE, 0); } return ACE_Singleton<TYPE, LOCK>::instance_; diff --git a/ace/Stream.cpp b/ace/Stream.cpp index 5780ecbc6c4..3c338d1bcee 100644 --- a/ace/Stream.cpp +++ b/ace/Stream.cpp @@ -126,6 +126,7 @@ ACE_Stream<ACE_SYNCH_2>::pop (u_long flags) // Close the top ACE_Module. top->close (flags); + delete top; this->stream_head_->writer ()->next (new_top->writer ()); new_top->reader ()->next (this->stream_head_->reader ()); @@ -151,7 +152,9 @@ ACE_Stream<ACE_SYNCH_2>::remove (const char *name, u_long flags) else prev->link (mod->next ()); + // Close down the module and release the memory. mod->close (flags); + delete mod; return 0; } else @@ -263,9 +266,8 @@ ACE_Stream<ACE_SYNCH_2>::open (void *a, delete h2; delete t1; delete t2; - // Note that we can't call delete on these, we must call close! - head->close (); - tail->close (); + delete head; + delete tail; errno = ENOMEM; return -1; } @@ -300,10 +302,8 @@ ACE_Stream<ACE_SYNCH_2>::close (u_long flags) // Remove and cleanup all the intermediate modules. while (this->stream_head_->next () != this->stream_tail_) - { - if (this->pop (flags) == -1) - result = -1; - } + if (this->pop (flags) == -1) + result = -1; // Clean up the head and tail of the stream. if (this->stream_head_->close (flags) == -1) @@ -311,6 +311,10 @@ ACE_Stream<ACE_SYNCH_2>::close (u_long flags) if (this->stream_tail_->close (flags) == -1) result = -1; + // Cleanup the memory. + delete this->stream_head_; + delete this->stream_tail_; + this->stream_head_ = 0; this->stream_tail_ = 0; @@ -499,6 +503,7 @@ template <ACE_SYNCH_1> ACE_INLINE ACE_Stream<ACE_SYNCH_2>::~ACE_Stream (void) { ACE_TRACE ("ACE_Stream<ACE_SYNCH_2>::~ACE_Stream"); + if (this->stream_head_ != 0) this->close (); } diff --git a/ace/Stream.i b/ace/Stream.i index 2a0fcc438a2..368eec8d858 100644 --- a/ace/Stream.i +++ b/ace/Stream.i @@ -3,8 +3,6 @@ // Stream.i -#include "ace/Log_Msg.h" - template <ACE_SYNCH_1> ACE_INLINE ACE_Module<ACE_SYNCH_2> * ACE_Stream<ACE_SYNCH_2>::head (void) { diff --git a/ace/Stream_Modules.cpp b/ace/Stream_Modules.cpp index f136e9431df..54c6c854435 100644 --- a/ace/Stream_Modules.cpp +++ b/ace/Stream_Modules.cpp @@ -31,7 +31,7 @@ ACE_Stream_Head<ACE_SYNCH_2>::dump (void) const ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_2>::dump"); } -/* ACE_Module that act as the head and tail of a Stream. */ +// ACE_Module that act as the head and tail of a Stream. template <ACE_SYNCH_1> int ACE_Stream_Head<ACE_SYNCH_2>::open (void *) diff --git a/ace/Stream_Modules.h b/ace/Stream_Modules.h index bd64afbf828..26e3151ae1a 100644 --- a/ace/Stream_Modules.h +++ b/ace/Stream_Modules.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp index f2044a8b05a..39aff9dbf80 100644 --- a/ace/Svc_Handler.cpp +++ b/ace/Svc_Handler.cpp @@ -6,7 +6,6 @@ #define ACE_BUILD_DLL #include "ace/Svc_Handler.h" -#include "ace/Log_Msg.h" #include "ace/Dynamic.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Synch.cpp b/ace/Synch.cpp index 836f8a693c3..8c1598a72ea 100644 --- a/ace/Synch.cpp +++ b/ace/Synch.cpp @@ -7,7 +7,6 @@ #define ACE_BUILD_DLL #include "ace/Thread.h" #include "ace/Synch.h" -#include "ace/Log_Msg.h" #include "ace/Time_Value.h" #if !defined (__ACE_INLINE__) @@ -149,6 +148,74 @@ ACE_File_Lock::~ACE_File_Lock (void) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_File_Lock::~ACE_File_Lock")); } +void +ACE_Process_Semaphore::dump (void) const +{ +// ACE_TRACE ("ACE_Process_Semaphore::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, + LPCTSTR name, + void *arg, + int max) +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) + : lock_ (count, USYNC_PROCESS, name, arg, max) +#else + : lock_ (name, ACE_SV_Semaphore_Complex::ACE_CREATE, count) +#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM */ +{ + arg = arg; + max = max; +// ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); +} + +ACE_Process_Semaphore::~ACE_Process_Semaphore (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore"); +} + +// Explicitly destroy the semaphore. + +int +ACE_Process_Semaphore::remove (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::remove"); + return this->lock_.remove (); +} + +// Block the thread until the semaphore count becomes +// greater than 0, then decrement it. + +int +ACE_Process_Semaphore::acquire (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::acquire"); + return this->lock_.acquire (); +} + +// Conditionally decrement the semaphore if count is greater +// than 0 (i.e., won't block). + +int +ACE_Process_Semaphore::tryacquire (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::tryacquire"); + return this->lock_.tryacquire (); +} + +// Increment the semaphore, potentially unblocking +// a waiting thread. + +int +ACE_Process_Semaphore::release (void) +{ +// ACE_TRACE ("ACE_Process_Semaphore::release"); + return this->lock_.release (); +} + #if defined (ACE_HAS_THREADS) ACE_Event::ACE_Event (int manual_reset, @@ -302,74 +369,6 @@ ACE_Thread_Semaphore::ACE_Thread_Semaphore (u_int count, // ACE_TRACE ("ACE_Thread_Semaphore::ACE_Thread_Semaphore"); } -void -ACE_Process_Semaphore::dump (void) const -{ -// ACE_TRACE ("ACE_Process_Semaphore::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, - LPCTSTR name, - void *arg, - int max) -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) - : lock_ (count, USYNC_PROCESS, name, arg, max) -#else - : lock_ (name, ACE_SV_Semaphore_Complex::ACE_CREATE, count) -#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM */ -{ - arg = arg; - max = max; -// ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); -} - -ACE_Process_Semaphore::~ACE_Process_Semaphore (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore"); -} - -// Explicitly destroy the semaphore. - -int -ACE_Process_Semaphore::remove (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::remove"); - return this->lock_.remove (); -} - -// Block the thread until the semaphore count becomes -// greater than 0, then decrement it. - -int -ACE_Process_Semaphore::acquire (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::acquire"); - return this->lock_.acquire (); -} - -// Conditionally decrement the semaphore if count is greater -// than 0 (i.e., won't block). - -int -ACE_Process_Semaphore::tryacquire (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::tryacquire"); - return this->lock_.tryacquire (); -} - -// Increment the semaphore, potentially unblocking -// a waiting thread. - -int -ACE_Process_Semaphore::release (void) -{ -// ACE_TRACE ("ACE_Process_Semaphore::release"); - return this->lock_.release (); -} - ACE_Semaphore::~ACE_Semaphore (void) { // ACE_TRACE ("ACE_Semaphore::~ACE_Semaphore"); diff --git a/ace/Synch.h b/ace/Synch.h index 030f7996c8b..bcc3e52c1a6 100644 --- a/ace/Synch.h +++ b/ace/Synch.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -106,6 +105,50 @@ protected: ACE_File_Lock (const ACE_File_Lock &) {} }; +class ACE_Export ACE_Process_Semaphore + // = TITLE + // Wrapper for Dijkstra style general semaphores that work + // across processes. +{ +public: + ACE_Process_Semaphore (u_int count, LPCTSTR name = 0, + void * = 0, int max = 0x7FFFFFFF); + // Initialize the semaphore, with an initial value of <count> and a + // maximum value of <max>. + + ~ACE_Process_Semaphore (void); + // Implicitly destroy the semaphore. + + int remove (void); + // Explicitly destroy the semaphore. + + int acquire (void); + // Block the thread until the semaphore count becomes + // greater than 0, then decrement it. + + int tryacquire (void); + // Conditionally decrement the semaphore if count is greater + // than 0 (i.e., won't block). + + int release (void); + // Increment the semaphore, potentially unblocking + // a waiting thread. + + void dump (void) const; + // Dump the state of an object. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +private: +#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) + ACE_Semaphore lock_; +#else + ACE_SV_Semaphore_Complex lock_; + // We need this to get the right semantics... +#endif /* ACE_WIN32 */ +}; + #if defined (ACE_HAS_THREADS) // ACE platform supports some form of threading. class ACE_Export ACE_Event @@ -679,50 +722,6 @@ public: // Declare the dynamic allocation hooks. }; -class ACE_Export ACE_Process_Semaphore - // = TITLE - // Wrapper for Dijkstra style general semaphores that work - // across processes. -{ -public: - ACE_Process_Semaphore (u_int count, LPCTSTR name = 0, - void * = 0, int max = 0x7FFFFFFF); - // Initialize the semaphore, with an initial value of <count> and a - // maximum value of <max>. - - ~ACE_Process_Semaphore (void); - // Implicitly destroy the semaphore. - - int remove (void); - // Explicitly destroy the semaphore. - - int acquire (void); - // Block the thread until the semaphore count becomes - // greater than 0, then decrement it. - - int tryacquire (void); - // Conditionally decrement the semaphore if count is greater - // than 0 (i.e., won't block). - - int release (void); - // Increment the semaphore, potentially unblocking - // a waiting thread. - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -private: -#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) - ACE_Semaphore lock_; -#else - ACE_SV_Semaphore_Complex lock_; - // We need this to get the right semantics... -#endif /* ACE_WIN32 */ -}; - struct ACE_Export ACE_Sub_Barrier { // = Initialization. diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp index 6b7ff67dafe..6e371199365 100644 --- a/ace/Synch_T.cpp +++ b/ace/Synch_T.cpp @@ -5,7 +5,6 @@ #define ACE_SYNCH_T_C #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Thread.h" #include "ace/Time_Value.h" #include "ace/Synch_T.h" @@ -41,7 +40,7 @@ ACE_Test_and_Set<LOCK, TYPE>::set (TYPE status) } template <class LOCK, class TYPE> int -ACE_Test_and_Set<LOCK, TYPE>::handle_signal (int signum, siginfo_t *, ucontext_t *) +ACE_Test_and_Set<LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *) { this->set (1); return 0; diff --git a/ace/TLI.cpp b/ace/TLI.cpp index 8f2ae8726b5..5c584cbf1ee 100644 --- a/ace/TLI.cpp +++ b/ace/TLI.cpp @@ -1,12 +1,11 @@ // TLI.cpp // $Id$ -/* Defines the member functions for the base class of the ACE_TLI - abstraction. */ +// Defines the member functions for the base class of the ACE_TLI +// abstraction. #define ACE_BUILD_DLL #include "ace/TLI.h" -#include "ace/Log_Msg.h" #if defined (ACE_HAS_TLI) diff --git a/ace/TLI_Acceptor.cpp b/ace/TLI_Acceptor.cpp index 12415b3611a..5271bcc1ac7 100644 --- a/ace/TLI_Acceptor.cpp +++ b/ace/TLI_Acceptor.cpp @@ -4,7 +4,6 @@ #define ACE_BUILD_DLL #include "ace/TLI_Acceptor.h" -#include "ace/Log_Msg.h" #if defined (ACE_HAS_TLI) diff --git a/ace/TLI_Connector.i b/ace/TLI_Connector.i index 8cfb13e193e..28d12e3952d 100644 --- a/ace/TLI_Connector.i +++ b/ace/TLI_Connector.i @@ -3,8 +3,6 @@ // TLI_Connector.i -#include "ace/Log_Msg.h" - inline ACE_TLI_Connector::ACE_TLI_Connector (ACE_TLI_Stream &new_stream, const ACE_Addr &remote_sap, diff --git a/ace/TLI_Stream.cpp b/ace/TLI_Stream.cpp index babca46d529..ed32039f151 100644 --- a/ace/TLI_Stream.cpp +++ b/ace/TLI_Stream.cpp @@ -6,7 +6,6 @@ #define ACE_BUILD_DLL #include "ace/TLI_Stream.h" -#include "ace/Log_Msg.h" #if defined (ACE_HAS_TLI) diff --git a/ace/TTY_IO.h b/ace/TTY_IO.h index f0cbee7d1e5..cf24e2bad6f 100644 --- a/ace/TTY_IO.h +++ b/ace/TTY_IO.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -20,7 +19,6 @@ #if !defined (ACE_TTY_H) #define ACE_TTY_H -#include "ace/Log_Msg.h" #include "ace/OS.h" #include "ace/DEV_Addr.h" #include "ace/DEV_Connector.h" diff --git a/ace/Task.i b/ace/Task.i index e5bf79b480a..bf6d310d2fc 100644 --- a/ace/Task.i +++ b/ace/Task.i @@ -3,8 +3,6 @@ // Task.i -#include "ace/Log_Msg.h" - ACE_INLINE ACE_Thread_Manager * ACE_Task_Base::thr_mgr (void) { diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h index 7cde91d5d93..547fa0285b1 100644 --- a/ace/Thread_Manager.h +++ b/ace/Thread_Manager.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -18,7 +17,6 @@ #if !defined (ACE_THREAD_MANAGER_H) #define ACE_THREAD_MANAGER_H -#include "ace/Log_Msg.h" #include "ace/Thread.h" #include "ace/Synch.h" diff --git a/ace/Thread_Manager.i b/ace/Thread_Manager.i index 5cb1444d5b4..e502817256c 100644 --- a/ace/Thread_Manager.i +++ b/ace/Thread_Manager.i @@ -3,8 +3,6 @@ // Thread_Manager.i -#include "ace/Log_Msg.h" - // Unique thread id. ACE_INLINE ACE_thread_t ACE_Thread_Descriptor::self (void) diff --git a/ace/Time_Request_Reply.cpp b/ace/Time_Request_Reply.cpp index 2234e960d22..8bc312de498 100644 --- a/ace/Time_Request_Reply.cpp +++ b/ace/Time_Request_Reply.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Time_Request_Reply.h" // Default "do nothing" constructor. diff --git a/ace/Token_Collection.cpp b/ace/Token_Collection.cpp index 0f98fbb0b75..1cc1e433a18 100644 --- a/ace/Token_Collection.cpp +++ b/ace/Token_Collection.cpp @@ -4,7 +4,6 @@ #define ACE_BUILD_DLL #include "ace/Token_Collection.h" -#include "ace/Log_Msg.h" #if !defined (__INLINE__) #include "ace/Token_Collection.i" diff --git a/ace/Token_Invariants.cpp b/ace/Token_Invariants.cpp index ded320b5737..a9a18f7b5f8 100644 --- a/ace/Token_Invariants.cpp +++ b/ace/Token_Invariants.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Token_Invariants.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Token_Manager.cpp b/ace/Token_Manager.cpp index b144a71505a..fcaa86d805c 100644 --- a/ace/Token_Manager.cpp +++ b/ace/Token_Manager.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Token_Manager.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Token_Request_Reply.cpp b/ace/Token_Request_Reply.cpp index fa5eb98ad33..5e372feeebb 100644 --- a/ace/Token_Request_Reply.cpp +++ b/ace/Token_Request_Reply.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Token_Request_Reply.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Trace.cpp b/ace/Trace.cpp index 45bf0bbc52b..24a16660c6a 100644 --- a/ace/Trace.cpp +++ b/ace/Trace.cpp @@ -23,7 +23,6 @@ #endif /* !ACE_HAS_INLINED_OSCALLS */ #include "ace/Log_Msg.h" - #include "ace/Trace.h" #if !defined (__ACE_INLINE__) diff --git a/ace/Typed_SV_Message_Queue.i b/ace/Typed_SV_Message_Queue.i index 9dcbb07075c..9c38d6622b5 100644 --- a/ace/Typed_SV_Message_Queue.i +++ b/ace/Typed_SV_Message_Queue.i @@ -4,7 +4,6 @@ // Typed_SV_Message_Queue.i #include "ace/SV_Message_Queue.h" -#include "ace/Log_Msg.h" template <class T> ACE_INLINE int ACE_Typed_SV_Message_Queue<T>::open (key_t external_id, diff --git a/ace/UPIPE_Acceptor.cpp b/ace/UPIPE_Acceptor.cpp index 2312869be0d..4350f73b96d 100644 --- a/ace/UPIPE_Acceptor.cpp +++ b/ace/UPIPE_Acceptor.cpp @@ -3,7 +3,6 @@ #define ACE_BUILD_DLL #include "ace/UPIPE_Acceptor.h" -#include "ace/Log_Msg.h" #if defined (ACE_HAS_THREADS) diff --git a/ace/UPIPE_Connector.i b/ace/UPIPE_Connector.i index 5404622af03..77d7bb3f61e 100644 --- a/ace/UPIPE_Connector.i +++ b/ace/UPIPE_Connector.i @@ -3,8 +3,6 @@ // UPIPE_Connector.i -#include "ace/Log_Msg.h" - // Creates a Local ACE_UPIPE. inline diff --git a/ace/XtReactor.cpp b/ace/XtReactor.cpp index e51a3552181..c5335d7091b 100644 --- a/ace/XtReactor.cpp +++ b/ace/XtReactor.cpp @@ -2,7 +2,6 @@ // $Id$ #define ACE_BUILD_DLL -#include "ace/Log_Msg.h" #include "ace/Synch_T.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" diff --git a/ace/config-sunos4-g++.h b/ace/config-sunos4-g++.h index e20835a7b3d..ef991a7d125 100644 --- a/ace/config-sunos4-g++.h +++ b/ace/config-sunos4-g++.h @@ -55,9 +55,6 @@ // Compiler/platform provides the sockio.h file. #define ACE_HAS_SOCKIO_H -// Compiler has system V signals -#define ACE_HAS_SVR4_SIGNAL_T - // Compiler/platform supports struct strbuf #define ACE_HAS_STRBUF_T |