diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-26 18:46:21 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-26 18:46:21 +0000 |
commit | b5adfd4ffd24551632be96077fe9f519e10bfff7 (patch) | |
tree | c0b39d4473db1aaf1cd357b18174bc08d5cc5a2a /ace | |
parent | 5f1275d9dae3b389ae185f5f80eacf50578a3bb7 (diff) | |
download | ATCD-b5adfd4ffd24551632be96077fe9f519e10bfff7.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Acceptor.cpp | 2 | ||||
-rw-r--r-- | ace/Acceptor.h | 12 | ||||
-rw-r--r-- | ace/Activation_Queue.h | 2 | ||||
-rw-r--r-- | ace/Asynch_Acceptor.cpp | 4 | ||||
-rw-r--r-- | ace/Asynch_IO.cpp | 7 | ||||
-rw-r--r-- | ace/CORBA_Handler.cpp | 12 | ||||
-rw-r--r-- | ace/CORBA_Handler.h | 6 | ||||
-rw-r--r-- | ace/CORBA_Handler.i | 4 | ||||
-rw-r--r-- | ace/Connector.h | 8 | ||||
-rw-r--r-- | ace/Dump.cpp | 3 | ||||
-rw-r--r-- | ace/Dump.h | 15 | ||||
-rw-r--r-- | ace/Dump_T.h | 13 | ||||
-rw-r--r-- | ace/Dynamic_Service.cpp | 2 | ||||
-rw-r--r-- | ace/Filecache.h | 2 | ||||
-rw-r--r-- | ace/Hash_Map_Manager.cpp | 2 | ||||
-rw-r--r-- | ace/Local_Name_Space.h | 2 | ||||
-rw-r--r-- | ace/Local_Tokens.h | 4 | ||||
-rw-r--r-- | ace/Log_Msg.cpp | 18 | ||||
-rw-r--r-- | ace/Malloc.cpp | 65 | ||||
-rw-r--r-- | ace/Malloc.h | 17 | ||||
-rw-r--r-- | ace/Map_Manager.cpp | 2 | ||||
-rw-r--r-- | ace/Message_Block.cpp | 6 | ||||
-rw-r--r-- | ace/Message_Block.h | 1 | ||||
-rw-r--r-- | ace/Module.h | 2 | ||||
-rw-r--r-- | ace/Naming_Context.cpp | 3 | ||||
-rw-r--r-- | ace/OS.cpp | 8 | ||||
-rw-r--r-- | ace/OS.h | 14 | ||||
-rw-r--r-- | ace/OS.i | 9 | ||||
-rw-r--r-- | ace/Parse_Node.cpp | 2 |
29 files changed, 167 insertions, 80 deletions
diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index 7b92667a9b7..fa1e19ed7dd 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -615,7 +615,7 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_signal (int, siginfo_t *, ucontext_t *) { ACE_TRACE ("ACE_Strategy_Acceptor::handle_signal"); - ACE_Service_Config::end_reactor_event_loop (); + ACE_Reactor::end_event_loop (); return 0; } diff --git a/ace/Acceptor.h b/ace/Acceptor.h index 72339eddaa6..f25a7727c1e 100644 --- a/ace/Acceptor.h +++ b/ace/Acceptor.h @@ -52,7 +52,7 @@ public: // "Do-nothing" constructor. ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * = ACE_Service_Config::reactor (), + ACE_Reactor * = ACE_Reactor::instance(), int flags = 0); // Initialize and register <this> with the Reactor and listen for // connection requests at the designated <local_addr>. <flags> @@ -62,7 +62,7 @@ public: // <SVC_HANDLER> when it is opened. int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Service_Config::reactor (), + ACE_Reactor * = ACE_Reactor::instance (), int flags = 0); // Initialize and register <this> with the Reactor and listen for // connection requests at the designated <local_addr>. <flags> @@ -181,7 +181,7 @@ public: // Default constructor. ACE_Strategy_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor * = ACE_Service_Config::reactor (), + ACE_Reactor * = ACE_Reactor::instance (), ACE_Creation_Strategy<SVC_HANDLER> * = 0, ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> * = 0, ACE_Concurrency_Strategy<SVC_HANDLER> * = 0, @@ -194,7 +194,7 @@ public: // designated <local_addr>. int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Service_Config::reactor (), + ACE_Reactor * = ACE_Reactor::instance (), ACE_Creation_Strategy<SVC_HANDLER> * = 0, ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> * = 0, ACE_Concurrency_Strategy<SVC_HANDLER> * = 0, @@ -353,13 +353,13 @@ public: // "Do-nothing" constructor. ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Service_Config::reactor (), + ACE_Reactor * = ACE_Reactor::instance(), ACE_Concurrency_Strategy<SVC_HANDLER> * = 0); // Initialize the appropriate strategies for concurrency and // creation and then register <this> at the designated <local_addr>. int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Service_Config::reactor (), + ACE_Reactor * = ACE_Reactor::instance(), ACE_Concurrency_Strategy<SVC_HANDLER> * = 0); // Initialize the appropriate strategies for concurrency and // creation and then register <this> at the designated <local_addr>. diff --git a/ace/Activation_Queue.h b/ace/Activation_Queue.h index 0b8e06faab5..17fbc3fbc5a 100644 --- a/ace/Activation_Queue.h +++ b/ace/Activation_Queue.h @@ -18,7 +18,7 @@ #if !defined (ACE_ACTIVATION_QUEUE_H) #define ACE_ACTIVATION_QUEUE_H -#include "ace/Synch.h" +#include "ace/Synch_T.h" #include "ace/Message_Queue.h" #include "ace/Method_Object.h" diff --git a/ace/Asynch_Acceptor.cpp b/ace/Asynch_Acceptor.cpp index bc99d47a92e..0d614ad7d86 100644 --- a/ace/Asynch_Acceptor.cpp +++ b/ace/Asynch_Acceptor.cpp @@ -115,7 +115,7 @@ ACE_Asynch_Acceptor<HANDLER>::accept (size_t bytes_to_read) template <class HANDLER> void ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &result) { -#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400) +#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || (_WIN32_WINNT >= 0x0400) // If the asynchronous accept succeeds if (result.success ()) { @@ -179,7 +179,7 @@ ACE_Asynch_Acceptor<HANDLER>::parse_address (ACE_Message_Block &message_block, ACE_INET_Addr &remote_address, ACE_INET_Addr &local_address) { -#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400) +#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || (_WIN32_WINNT >= 0x0400) sockaddr *local_addr = 0; sockaddr *remote_addr = 0; int local_size = 0; diff --git a/ace/Asynch_IO.cpp b/ace/Asynch_IO.cpp index 3ecbc992bd4..94d9d939458 100644 --- a/ace/Asynch_IO.cpp +++ b/ace/Asynch_IO.cpp @@ -10,6 +10,7 @@ #include "ace/Proactor.h" #include "ace/Message_Block.h" #include "ace/Service_Config.h" +#include "ace/Inet_Addr.h" #if !defined (__ACE_INLINE__) #include "ace/Asynch_IO.i" @@ -118,7 +119,7 @@ ACE_Asynch_Operation::open (ACE_Handler &handler, // <handler->proactor> is zero this->proactor_ = this->handler_->proactor (); if (this->proactor_ == 0) - this->proactor_ = ACE_Service_Config::proactor (); + this->proactor_ = ACE_Proactor::instance(); } // Register with the <proactor> @@ -505,7 +506,7 @@ ACE_Asynch_Accept::accept (ACE_Message_Block &message_block, ACE_HANDLE accept_handle, const void *act) { -#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400) +#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || (_WIN32_WINNT >= 0x0400) // Sanity check: make sure that enough space has been allocated by the caller. size_t address_size = sizeof (sockaddr_in) + sizeof (sockaddr); size_t space_in_use = message_block.wr_ptr () - message_block.base (); @@ -658,7 +659,7 @@ ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, u_long flags, const void *act) { -#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400) +#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || (_WIN32_WINNT >= 0x0400) Result *result = 0; ACE_NEW_RETURN (result, Result (*this->handler_, diff --git a/ace/CORBA_Handler.cpp b/ace/CORBA_Handler.cpp index 98af56bd02d..fd6760ea551 100644 --- a/ace/CORBA_Handler.cpp +++ b/ace/CORBA_Handler.cpp @@ -8,7 +8,7 @@ #include "ace/CORBA_Handler.i" #endif /* __ACE_INLINE__ */ -#if defined (ACE_HAS_ORBIX) +#if defined (ACE_HAS_ORBIX) && (ACE_HAS_ORBIX != 0) ACE_ALLOC_HOOK_DEFINE(ACE_ST_CORBA_Handler) ACE_ALLOC_HOOK_DEFINE(ACE_CORBA_Handler) @@ -53,7 +53,7 @@ ACE_CORBA_Handler::~ACE_CORBA_Handler (void) } ACE_CORBA_Handler::ACE_CORBA_Handler (void) - : reactor_ (ACE_Service_Config::reactor ()) + : reactor_ (ACE_Reactor::instance ()) { ACE_TRACE ("ACE_CORBA_Handler::ACE_CORBA_Handler"); } @@ -339,11 +339,11 @@ ACE_CORBA_Handler::activate_service (const char *service_name, return 0; } -#if defined (ACE_HAS_MT_ORBIX) +#if defined (ACE_HAS_MT_ORBIX) && (ACE_HAS_MT_ORBIX != 0) ACE_ALLOC_HOOK_DEFINE(ACE_MT_CORBA_Handler) -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // Synchronize output operations. ACE_Thread_Mutex ACE_MT_CORBA_Handler::ace_mt_corba_handler_lock_; #endif /* ACE_MT_SAFE */ @@ -357,7 +357,7 @@ ACE_MT_CORBA_Handler::dump (void) const ACE_DEBUG ((LM_DEBUG, "instance_ = %x", this->instance_)); ACE_DEBUG ((LM_DEBUG, "\nthr_mgr_ = %x", this->thr_mgr_)); this->pipe_.dump (); -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // Double-Check lock. ace_mt_corba_handler_lock_.dump (); #endif /* ACE_MT_SAFE */ @@ -413,7 +413,7 @@ ACE_MT_CORBA_Handler::resume (void) ACE_MT_CORBA_Handler::ACE_MT_CORBA_Handler (void) { ACE_TRACE ("ACE_MT_CORBA_Handler::ACE_MT_CORBA_Handler"); - this->thr_mgr (ACE_Service_Config::thr_mgr ()); + this->thr_mgr (ACE_Thread_Manager::instance ()); int result = 0; diff --git a/ace/CORBA_Handler.h b/ace/CORBA_Handler.h index be576942983..468d570a489 100644 --- a/ace/CORBA_Handler.h +++ b/ace/CORBA_Handler.h @@ -22,7 +22,7 @@ #include "ace/Service_Config.h" #include "ace/Pipe.h" -#if defined (ACE_HAS_ORBIX) || defined (ACE_HAS_MT_ORBIX) +#if (defined (ACE_HAS_ORBIX) && (ACE_HAS_ORBIX != 0)) || (defined (ACE_HAS_MT_ORBIX) && (ACE_HAS_MT_ORBIX != 0)) #define EXCEPTIONS #define WANT_ORBIX_FDS #include /**/ <CORBA.h> @@ -166,7 +166,7 @@ protected: // Number of iterations to process per processNextEvent() call. }; -#if defined (ACE_HAS_MT_ORBIX) +#if defined (ACE_HAS_MT_ORBIX) && (ACE_HAS_MT_ORBIX != 0) class ACE_Export ACE_MT_CORBA_Handler : public ACE_CORBA_Handler, public ACE_CORBA_1 (ThreadFilter) // = TITLE @@ -223,7 +223,7 @@ protected: ACE_Pipe pipe_; // Used to send CORBA::Requests through the server -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) static ACE_Thread_Mutex ace_mt_corba_handler_lock_; // Double-Check lock. #endif /* ACE_MT_SAFE */ diff --git a/ace/CORBA_Handler.i b/ace/CORBA_Handler.i index 794b6da5d09..8b630a5fa11 100644 --- a/ace/CORBA_Handler.i +++ b/ace/CORBA_Handler.i @@ -3,7 +3,7 @@ // CORBA_Handler.i -#if defined (ACE_HAS_ORBIX) +#if defined (ACE_HAS_ORBIX) && (ACE_HAS_ORBIX != 0) // = Set/get the number of iterations per processNextEvent() call. /* static */ @@ -38,7 +38,7 @@ ACE_CORBA_Handler::reactor (void) return this->reactor_; } -#if defined (ACE_HAS_MT_ORBIX) +#if defined (ACE_HAS_MT_ORBIX) && (ACE_HAS_MT_ORBIX != 0) ACE_INLINE void ACE_MT_CORBA_Handler::thr_mgr (ACE_Thread_Manager *tm) { diff --git a/ace/Connector.h b/ace/Connector.h index c6f51f2bd44..2dcfe8973ba 100644 --- a/ace/Connector.h +++ b/ace/Connector.h @@ -109,7 +109,7 @@ public: typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; #endif /* ACE_HAS_TYPENAME_KEYWORD */ - ACE_Connector (ACE_Reactor *r = ACE_Service_Config::reactor (), + ACE_Connector (ACE_Reactor *r = ACE_Reactor::instance (), int flags = 0); // Initialize a connector. <flags> indicates how <SVC_HANDLER>'s // should be initialized prior to being activated. Right now, the @@ -117,7 +117,7 @@ public: // non-blocking I/O on the <SVC_HANDLER> when it is opened. - virtual int open (ACE_Reactor *r = ACE_Service_Config::reactor (), + virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), int flags = 0); // Initialize a connector. <flags> indicates how <SVC_HANDLER>'s // should be initialized prior to being activated. Right now, the @@ -292,7 +292,7 @@ class ACE_Strategy_Connector : public ACE_Connector <SVC_HANDLER, ACE_PEER_CONNE // particular concurrency mechanism. { public: - ACE_Strategy_Connector (ACE_Reactor *r = ACE_Service_Config::reactor (), + ACE_Strategy_Connector (ACE_Reactor *r = ACE_Reactor::instance (), ACE_Creation_Strategy<SVC_HANDLER> * = 0, ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0, ACE_Concurrency_Strategy<SVC_HANDLER> * = 0, @@ -302,7 +302,7 @@ public: // only flag that is processed is <ACE_NONBLOCK>, which enabled // non-blocking I/O on the <SVC_HANDLER> when it is opened. - virtual int open (ACE_Reactor *r = ACE_Service_Config::reactor (), + virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), ACE_Creation_Strategy<SVC_HANDLER> * = 0, ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> * = 0, ACE_Concurrency_Strategy<SVC_HANDLER> * = 0, diff --git a/ace/Dump.cpp b/ace/Dump.cpp index 7e0f742fbea..b84c61c380c 100644 --- a/ace/Dump.cpp +++ b/ace/Dump.cpp @@ -2,9 +2,10 @@ // $Id$ #define ACE_BUILD_DLL +#include "ace/Synch_T.h" #include "ace/Dump.h" -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // Synchronize output operations. ACE_Thread_Mutex ACE_ODB::ace_dump_lock_; #endif /* ACE_MT_SAFE */ diff --git a/ace/Dump.h b/ace/Dump.h index 51e8e0d5a9b..fb03a6adffb 100644 --- a/ace/Dump.h +++ b/ace/Dump.h @@ -143,24 +143,13 @@ private: int current_size_; // Current size of <object_table_>. -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) static ACE_Thread_Mutex ace_dump_lock_; // Double-Check lock. #endif /* ACE_MT_SAFE */ }; +// Include the templates classes at this point. #include "ace/Dump_T.h" -// Some useful macros for conditionally compiling this feature... -#if defined (ACE_NDEBUG) -#define ACE_REGISTER_OBJECT(CLASS) -#define ACE_REMOVE_OBJECT -#else -#define ACE_REGISTER_OBJECT(CLASS) \ - ACE_ODB::instance ()->register_object \ - (new ACE_Dumpable_Adapter<CLASS> (this)); -#define ACE_REMOVE_OBJECT \ - ACE_ODB::instance ()->remove_object \ - ((void *) this); -#endif /* ACE_NDEBUG */ #endif /* ACE_DUMP_H */ diff --git a/ace/Dump_T.h b/ace/Dump_T.h index d2ee0a62886..dd32b5623cf 100644 --- a/ace/Dump_T.h +++ b/ace/Dump_T.h @@ -50,6 +50,19 @@ private: // Pointer to <this> of <class Concrete>. }; +// Some useful macros for conditionally compiling this feature... +#if defined (ACE_NDEBUG) +#define ACE_REGISTER_OBJECT(CLASS) +#define ACE_REMOVE_OBJECT +#else +#define ACE_REGISTER_OBJECT(CLASS) \ + ACE_ODB::instance ()->register_object \ + (new ACE_Dumpable_Adapter<CLASS> (this)); +#define ACE_REMOVE_OBJECT \ + ACE_ODB::instance ()->remove_object \ + ((void *) this); +#endif /* ACE_NDEBUG */ + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Dump_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Dynamic_Service.cpp b/ace/Dynamic_Service.cpp index 05fec7a0913..8cb84b90ff4 100644 --- a/ace/Dynamic_Service.cpp +++ b/ace/Dynamic_Service.cpp @@ -27,7 +27,7 @@ ACE_Dynamic_Service<SERVICE>::instance (const char *name) ACE_TRACE ("ACE_Dynamic_Service::instance"); const ACE_Service_Record *svc_rec; - if (ACE_Service_Config::svc_rep ()->find (name, &svc_rec) == -1) + if (ACE_Service_Repository::instance ()->find (name, &svc_rec) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "svc_rep"), 0); const ACE_Service_Type *type = svc_rec->type (); diff --git a/ace/Filecache.h b/ace/Filecache.h index c3d403ee580..2b05da1b8c2 100644 --- a/ace/Filecache.h +++ b/ace/Filecache.h @@ -19,7 +19,7 @@ #define ACE_FILECACHE_H #include "ace/Mem_Map.h" -#include "ace/Synch.h" +#include "ace/Synch_T.h" // = Forward declarations. class ACE_Filecache_Object; diff --git a/ace/Hash_Map_Manager.cpp b/ace/Hash_Map_Manager.cpp index 2452b94f3e0..d30a9b39b32 100644 --- a/ace/Hash_Map_Manager.cpp +++ b/ace/Hash_Map_Manager.cpp @@ -102,7 +102,7 @@ ACE_Hash_Map_Manager<EXT_ID, INT_ID, LOCK>::open (size_t size, ACE_WRITE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1); if (alloc == 0) - alloc = ACE_Service_Config::alloc (); + alloc = ACE_Allocator::instance (); this->allocator_ = alloc; diff --git a/ace/Local_Name_Space.h b/ace/Local_Name_Space.h index e115903cc2f..6c9820f2214 100644 --- a/ace/Local_Name_Space.h +++ b/ace/Local_Name_Space.h @@ -21,7 +21,7 @@ #include "ace/SString.h" #include "ace/Containers.h" -#include "ace/Malloc.h" +#include "ace/Malloc_T.h" #include "ace/Synch.h" class ACE_Export ACE_NS_String diff --git a/ace/Local_Tokens.h b/ace/Local_Tokens.h index 3cd9c688b0f..cae37cd89bb 100644 --- a/ace/Local_Tokens.h +++ b/ace/Local_Tokens.h @@ -39,7 +39,7 @@ #if !defined (ACE_LOCAL_MUTEX_H) #define ACE_LOCAL_MUTEX_H -#include "ace/Synch.h" +#include "ace/Synch_T.h" #include "ace/Containers.h" #include "ace/Synch_Options.h" #include "ace/Map_Manager.h" @@ -55,7 +55,7 @@ class ACE_Export ACE_TOKEN_CONST // this class is necessary to fight the compiler with order of // declaration errors. public: -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // ACE platform supports some form of threading. typedef ACE_Condition_Thread_Mutex COND_VAR; typedef ACE_Thread_Mutex MUTEX; diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index f542dc47efc..9e9ec892419 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -22,7 +22,7 @@ #endif /* !ACE_HAS_INLINED_OSCALLS */ #include "ace/Thread.h" -#include "ace/Synch.h" +#include "ace/Synch_T.h" #include "ace/Signal.h" #include "ace/Containers.h" @@ -49,7 +49,7 @@ static ACE_FIFO_Send_Msg message_queue_; ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg) -#if !defined (VXWORKS) && defined (ACE_MT_SAFE) +#if !defined (VXWORKS) && defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) static int key_created_ = 0; static ACE_thread_key_t key_; #endif /* !VXWORKS && ACE_MT_SAFE */ @@ -63,7 +63,7 @@ static ACE_thread_key_t key_; if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ } while (0) -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) typedef ACE_Unbounded_Set<ACE_Log_Msg *> ACE_Log_Msg_Set; @@ -205,7 +205,7 @@ ACE_TSS_cleanup (void *ptr) int ACE_Log_Msg::exists (void) { -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) #if defined (VXWORKS) // Get the tss_log_msg from thread-specific storage, using one of // the "spare" fields in the task control block. Note that no locks @@ -237,7 +237,7 @@ ACE_Log_Msg::exists (void) ACE_Log_Msg * ACE_Log_Msg::instance (void) { -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) #if defined (VXWORKS) // Get the tss_log_msg from thread-specific storage, using one of // the "spare" fields in the task control block. Note that no locks @@ -431,7 +431,7 @@ int ACE_Log_Msg::acquire (void) { ACE_TRACE ("ACE_Log_Msg::acquire"); -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) return ACE_Log_Msg_Manager::get_lock ()->acquire (); #else return 0; @@ -457,7 +457,7 @@ ACE_Log_Msg::release (void) { ACE_TRACE ("ACE_Log_Msg::release"); -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) return ACE_Log_Msg_Manager::get_lock ()->release (); #else return 0; @@ -496,7 +496,7 @@ ACE_Log_Msg::~ACE_Log_Msg (void) // <program_name_> and <local_host_> strings weren't duplicated, in // order to avoid memory leaks, because this destructor can't tell // when the last thread in the program exits. -#if !defined (VXWORKS) && defined (ACE_MT_SAFE) +#if !defined (VXWORKS) && defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, *ACE_Log_Msg_Manager::get_lock ())); // If this is the last instance then cleanup. @@ -1067,7 +1067,7 @@ ACE_Log_Msg::dump (void) const ACE_DEBUG ((LM_DEBUG, "\thr_state_ = %d\n", *this->thr_state_)); ACE_DEBUG ((LM_DEBUG, "\nmsg_off_ = %d\n", this->msg_off_)); message_queue_.dump (); -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) ACE_Log_Msg_Manager::get_lock ()->dump (); // Synchronize output operations. #endif /* ACE_MT_SAFE */ diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp index cbda9a32c61..cf19f237a66 100644 --- a/ace/Malloc.cpp +++ b/ace/Malloc.cpp @@ -11,6 +11,21 @@ #include "ace/Malloc.i" #endif /* __ACE_INLINE__ */ +#include "ace/Synch_T.h" + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +// Lock the creation of the Singletons. +static ACE_Thread_Mutex ace_allocator_lock_; +#endif /* ACE_MT_SAFE */ + +// Process-wide ACE_Allocator. +ACE_Allocator *ACE_Allocator::allocator_ = 0; + +// Controls whether the Allocator is deleted when we shut down (we can +// only delete it safely if we created it!) +int ACE_Allocator::delete_allocator_ = 0; + + void ACE_Control_Block::dump (void) const { @@ -51,6 +66,56 @@ ACE_Name_Node::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } +ACE_Allocator * +ACE_Allocator::instance (void) +{ + ACE_TRACE ("ACE_Allocator::instance"); + + if (ACE_Allocator::allocator_ == 0) + { + // Perform Double-Checked Locking Optimization. + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_allocator_lock_, 0)); + + if (ACE_Allocator::allocator_ == 0) + { + ACE_NEW_RETURN (ACE_Allocator::allocator_, + ACE_New_Allocator, + 0); + ACE_Allocator::delete_allocator_ = 1; + } + } + return ACE_Allocator::allocator_; +} + +ACE_Allocator * +ACE_Allocator::instance (ACE_Allocator *r) +{ + ACE_TRACE ("ACE_Allocator::instance"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ace_allocator_lock_, 0)); + ACE_Allocator *t = ACE_Allocator::allocator_; + + // We can't safely delete it since we don't know who created it! + ACE_Allocator::delete_allocator_ = 0; + + ACE_Allocator::allocator_ = r; + return t; +} + +void +ACE_Allocator::close_singleton (void) +{ + ACE_TRACE ("ACE_Allocator::close_singleton"); + + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, ace_allocator_lock_)); + + if (ACE_Allocator::delete_allocator_) + { + delete ACE_Allocator::allocator_; + ACE_Allocator::allocator_ = 0; + ACE_Allocator::delete_allocator_ = 0; + } +} + ACE_Allocator::~ACE_Allocator (void) { ACE_TRACE ("ACE_Allocator::~ACE_Allocator"); diff --git a/ace/Malloc.h b/ace/Malloc.h index 40efd4d5603..21adedae246 100644 --- a/ace/Malloc.h +++ b/ace/Malloc.h @@ -28,6 +28,16 @@ class ACE_Export ACE_Allocator public: // = Memory Management + static ACE_Allocator *instance (void); + // Get pointer to a default <ACE_Allocator>. + + static ACE_Allocator *instance (ACE_Allocator *); + // Set pointer to a process-wide <ACE_Allocator> and return existing + // pointer. + + static void close_singleton (void); + // Delete the dynamically allocated Singleton + virtual ~ACE_Allocator (void); // Virtual destructor @@ -107,6 +117,13 @@ public: virtual void dump (void) const = 0; // Dump the state of the object. +private: + + static ACE_Allocator *allocator_; + // Pointer to a process-wide <ACE_Allocator> instance. + + static int delete_allocator_; + // Must delete the <allocator_> if non-0. }; #if defined (ACE_MALLOC_STATS) diff --git a/ace/Map_Manager.cpp b/ace/Map_Manager.cpp index 5e42d0deab7..f7381330305 100644 --- a/ace/Map_Manager.cpp +++ b/ace/Map_Manager.cpp @@ -165,7 +165,7 @@ ACE_Map_Manager<EXT_ID, INT_ID, LOCK>::open (size_t size, ACE_WRITE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1); if (alloc == 0) - alloc = ACE_Service_Config::alloc (); + alloc = ACE_Allocator::instance (); this->allocator_ = alloc; diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 0c4c1e1b4f5..e29561e55a8 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -3,7 +3,7 @@ #define ACE_BUILD_DLL #include "ace/Message_Block.h" -#include "ace/Service_Config.h" +#include "ace/Synch_T.h" #if !defined (__ACE_INLINE__) #include "ace/Message_Block.i" @@ -196,9 +196,9 @@ ACE_Data_Block::ACE_Data_Block (size_t size, ACE_TRACE ("ACE_Data_Block::ACE_Data_Block"); // If the user didn't pass one in, let's use the - // <ACE_Service_Config::alloc>. + // <ACE_Allocator::instance>. if (this->allocator_strategy_ == 0) - ACE_ALLOCATOR (this->allocator_strategy_, ACE_Service_Config::alloc ()); + ACE_ALLOCATOR (this->allocator_strategy_, ACE_Allocator::instance ()); if (msg_data == 0) ACE_ALLOCATOR (this->base_, diff --git a/ace/Message_Block.h b/ace/Message_Block.h index a1a8600e118..bfa26d5c5f0 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -23,6 +23,7 @@ // Forward declaration. class ACE_Data_Block; +class ACE_Lock; class ACE_Export ACE_Message_Block // = TITLE diff --git a/ace/Module.h b/ace/Module.h index 6370b6478c9..2817935b325 100644 --- a/ace/Module.h +++ b/ace/Module.h @@ -18,7 +18,7 @@ #define ACE_MODULE_H #include "ace/ACE.h" -#include "ace/Task.h" +#include "ace/Task_T.h" // Forward decl. // template <ACE_SYNCH_1> class ACE_Task; diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index 8402d181fd7..2a19ec5290d 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -5,8 +5,9 @@ #include "ace/Get_Opt.h" #include "ace/Naming_Context.h" #include "ace/Remote_Name_Space.h" -#include "ace/Local_Name_Space.h" +#include "ace/Local_Name_Space_T.h" #include "ace/Registry_Name_Space.h" +#include "ace/Memory_Pool.h" // Make life easier later on... diff --git a/ace/OS.cpp b/ace/OS.cpp index 25392e249d6..f0cdf49e4c0 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -16,10 +16,10 @@ #include "ace/OS.i" #endif /* ACE_HAS_INLINED_OS_CALLS */ -#include "ace/Synch.h" +#include "ace/Synch_T.h" #include "ace/Containers.h" -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // This is lock defines a monitor that is shared by all threads // calling certain ACE_OS methods. @@ -1031,7 +1031,7 @@ ACE_TSS_Cleanup::exit (void *status) } } -#if defined (ACE_HAS_MFC) +#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) // allow CWinThread-destructor to be invoked from AfxEndThread // _endthreadex will be called from AfxEndThread so don't exit the // thread now if we are running an MFC thread. @@ -1712,7 +1712,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, ACE_UNUSED_ARG (stack); ACE_Thread_Adapter *thread_args; ACE_NEW_RETURN (thread_args, ACE_Thread_Adapter (func, args), -1); -# if defined (ACE_HAS_MFC) +# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) if (ACE_BIT_ENABLED (flags, THR_USE_AFX)) { CWinThread *cwin_thread = @@ -410,7 +410,7 @@ typedef int key_t; // use these macros so that we don't end up with ACE software // hard-coded to Microsoft proprietary extensions to C++. -#if defined (ACE_HAS_DLL) +#if defined (ACE_HAS_DLL) && (ACE_HAS_DLL == 1) #if defined (ACE_BUILD_DLL) #if !defined (_MSC_VER) /* Mark classes as exported, Borland. */ #define ACE_Export _export @@ -429,7 +429,7 @@ typedef int key_t; #define ACE_Export #endif /* ACE_HAS_DLL */ -#if defined (ACE_HAS_SVC_DLL) +#if defined (ACE_HAS_SVC_DLL) && (ACE_HAS_SVC_DLL == 1) #if defined (ACE_BUILD_SVC_DLL) #if !defined (_MSC_VER) /* Mark classes as exported, Borland. */ #define ACE_Svc_Export _export @@ -957,7 +957,7 @@ typedef struct rlimit ACE_SETRLIMIT_TYPE; typedef const struct rlimit ACE_SETRLIMIT_TYPE; #endif /* ACE_HAS_BROKEN_SETRLIMIT */ -#if defined (ACE_MT_SAFE) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) #define ACE_MT(X) X #if !defined (_REENTRANT) #define _REENTRANT @@ -1464,7 +1464,7 @@ protected: // number of readers holding the lock. }; #elif !defined (ACE_HAS_STHREADS) -#include <synch.h> +#include /**/ <synch.h> typedef rwlock_t ACE_rwlock_t; #endif /* ACE_LACKS_RWLOCK_T */ @@ -1678,7 +1678,7 @@ struct utsname // HANDLES in Windows. So for example, STRICT prevents you from // mistakenly passing an HPEN to a routine expecting an HBITMAP. // Note that we only use this if we -#if defined (ACE_HAS_STRICT) +#if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0) #if !defined (STRICT) /* may already be defined */ #define STRICT #endif /* !STRICT */ @@ -1802,7 +1802,7 @@ PAGE_GUARD PAGE_NOACCESS PAGE_NOCACHE */ -#if defined (ACE_HAS_WINSOCK2) +#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) #include "ace/ws2tcpip.h" #endif /* ACE_HAS_WINSOCK2 */ @@ -3526,7 +3526,7 @@ private: ACE_OS (void); // Ensure we can't define an instance of this class. -#if defined (ACE_MT_SAFE) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) static int netdb_acquire (void); static int netdb_release (void); #endif /* defined (ACE_MT_SAFE) && ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */ @@ -2621,8 +2621,7 @@ ACE_OS::rw_rdlock (ACE_rwlock_t *rw) while (rw->ref_count_ < 0 || rw->num_waiting_writers_ > 0) { rw->num_waiting_readers_++; - if (ACE_OS::cond_wait (&rw->waiting_readers_, - &rw->lock_) == -1) + if (ACE_OS::cond_wait (&rw->waiting_readers_, &rw->lock_) == -1) { result = -2; // -2 means that we need to release the mutex. break; @@ -2637,7 +2636,7 @@ ACE_OS::rw_rdlock (ACE_rwlock_t *rw) #if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) ACE_PTHREAD_CLEANUP_POP (0); #endif - return result < 0 ? -1 : result; + return 0; #endif /* ACE_HAS_STHREADS */ #else ACE_UNUSED_ARG (rw); @@ -2798,7 +2797,7 @@ ACE_OS::rw_wrlock (ACE_rwlock_t *rw) #if defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) ACE_PTHREAD_CLEANUP_POP (0); #endif /* defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) */ - return result < 0 ? -1 : result; + return 0; #endif /* ACE_HAS_STHREADS */ #else ACE_UNUSED_ARG (rw); @@ -3176,7 +3175,7 @@ ACE_OS::event_reset (ACE_event_t *event) #define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE) #endif /* ACE_WIN32 */ -#if defined (ACE_MT_SAFE) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) #define ACE_NETDBCALL_RETURN(OP,TYPE,FAILVALUE,TARGET,SIZE) \ do \ { \ diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp index ce193bd0e79..42c1f392b9b 100644 --- a/ace/Parse_Node.cpp +++ b/ace/Parse_Node.cpp @@ -259,7 +259,7 @@ ACE_Static_Node::record (void) const ACE_TRACE ("ACE_Static_Node::record"); ACE_Service_Record *sr; - if (ACE_Service_Config::svc_rep ()->find (this->name (), + if (ACE_Service_Repository::instance()->find (this->name (), (const ACE_Service_Record **) &sr) == -1) return 0; else |