diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-04-23 04:26:25 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-04-23 04:26:25 +0000 |
commit | c6f9f9870852ee1df8b4496f318f38414ac66578 (patch) | |
tree | 18c6cc58e4961fdf9908868a8dd4647126a88d02 /ace | |
parent | 213e70bf20e959bde614bc00198f9367a23bf4a3 (diff) | |
download | ATCD-c6f9f9870852ee1df8b4496f318f38414ac66578.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Hash_Map_Manager.cpp | 14 | ||||
-rw-r--r-- | ace/Hash_Map_Manager.h | 6 | ||||
-rw-r--r-- | ace/LSOCK.h | 6 | ||||
-rw-r--r-- | ace/Local_Name_Space.h | 2 | ||||
-rw-r--r-- | ace/README | 1 | ||||
-rw-r--r-- | ace/Strategies_T.cpp | 82 | ||||
-rw-r--r-- | ace/Strategies_T.h | 56 | ||||
-rw-r--r-- | ace/config-sunos5.4-centerline-2.x.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.4-g++.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.4-sunc++-4.x-orbix.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.4-sunc++-4.x.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.5-g++.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.5-sunc++-4.1.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.5-sunc++-4.x-orbix.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.5-sunc++-4.x.h | 2 |
15 files changed, 167 insertions, 16 deletions
diff --git a/ace/Hash_Map_Manager.cpp b/ace/Hash_Map_Manager.cpp index 15d86d8a95c..2b4986ec44d 100644 --- a/ace/Hash_Map_Manager.cpp +++ b/ace/Hash_Map_Manager.cpp @@ -191,11 +191,17 @@ ACE_Hash_Map_Manager<EXT_ID, INT_ID, LOCK>::total_size (void) return this->total_size_; } +template <class EXT_ID, class INT_ID, class LOCK> size_t +ACE_Hash_Map_Manager<EXT_ID, INT_ID, LOCK>::hash (const EXT_ID &ext_id) +{ + return ext_id.hash (); +} + template <class EXT_ID, class INT_ID, class LOCK> int ACE_Hash_Map_Manager<EXT_ID, INT_ID, LOCK>::bind_i (const EXT_ID &ext_id, const INT_ID &int_id) { - size_t loc = ext_id.hash () % this->total_size_; + size_t loc = this->hash (ext_id) % this->total_size_; ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc]; @@ -235,7 +241,7 @@ template <class EXT_ID, class INT_ID, class LOCK> int ACE_Hash_Map_Manager<EXT_ID, INT_ID, LOCK>::trybind_i (const EXT_ID &ext_id, INT_ID &int_id) { - size_t loc = ext_id.hash () % this->total_size_; + size_t loc = this->hash (ext_id) % this->total_size_; ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc]; @@ -279,7 +285,7 @@ template <class EXT_ID, class INT_ID, class LOCK> int ACE_Hash_Map_Manager<EXT_ID, INT_ID, LOCK>::unbind_i (const EXT_ID &ext_id, INT_ID &int_id) { - size_t loc = ext_id.hash () % this->total_size_; + size_t loc = this->hash (ext_id) % this->total_size_; ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc]; ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev = 0; @@ -334,7 +340,7 @@ template <class EXT_ID, class INT_ID, class LOCK> int ACE_Hash_Map_Manager<EXT_ID, INT_ID, LOCK>::shared_find (const EXT_ID &ext_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) { - size_t loc = ext_id.hash () % total_size_; + size_t loc = this->hash (ext_id) % this->total_size_; ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc]; diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h index 3800b241b0f..d8c70e9b669 100644 --- a/ace/Hash_Map_Manager.h +++ b/ace/Hash_Map_Manager.h @@ -153,8 +153,10 @@ public: protected: // = The following methods do the actual work. - // These methods assume that the locks are held by the private - // methods. + size_t hash (const EXT_ID &ext_id); + // Compute the hash value of the <ext_id>. + + // = These methods assume locks are held by private methods. int bind_i (const EXT_ID &ext_id, const INT_ID &int_id); // Performs the binding of <ext_id> to <int_id>. Must be diff --git a/ace/LSOCK.h b/ace/LSOCK.h index 6c7c922a830..283d0c87a23 100644 --- a/ace/LSOCK.h +++ b/ace/LSOCK.h @@ -59,6 +59,12 @@ protected: void set_handle (ACE_HANDLE handle); // Set handle. +#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) + static const int msg_control_len_ + = sizeof(struct cmsghdr) + sizeof(ACE_HANDLE) ; + // control message size to pass a file descriptor +#endif // ACE_HAS_4_4BSD_SENDMSG_RECVMSG + private: ACE_HANDLE aux_handle_; // An auxiliary handle used to avoid virtual base classes... diff --git a/ace/Local_Name_Space.h b/ace/Local_Name_Space.h index 4d13b1971a1..cee5042db1c 100644 --- a/ace/Local_Name_Space.h +++ b/ace/Local_Name_Space.h @@ -1,8 +1,6 @@ /* -*- C++ -*- */ // $Id$ -/*-*- C++ -*- */ - // ============================================================================ // // = LIBRARY diff --git a/ace/README b/ace/README index ea044cceb2b..0d41b5842db 100644 --- a/ace/README +++ b/ace/README @@ -128,6 +128,7 @@ ACE_HAS_SYSV_SPRINTF Platform/compiler support the System V sprintf(). ACE_HAS_SYS_ERRLIST Platform/compiler supports _sys_errlist symbol ACE_HAS_SYS_FILIO_H Platform provides <sys/filio.h> header ACE_HAS_SYS_SIGLIST Compiler/platform supports _sys_siglist array +ACE_HAS_TEMPLATE_SPECIALIZATION Compiler implements template specialization ACE_HAS_TEMPLATE_TYPEDEFS Compiler implements templates that support typedefs inside of classes used as formal arguments to a template class. ACE_HAS_TERM_IOCTLS Platform has terminal ioctl flags like TCGETS and TCSETS. ACE_HAS_THREADS Platform supports threads diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp index 2559fde2f42..67d87fd76b9 100644 --- a/ace/Strategies_T.cpp +++ b/ace/Strategies_T.cpp @@ -203,6 +203,75 @@ ACE_Concurrency_Strategy<SVC_HANDLER>::~ACE_Concurrency_Strategy (void) ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy) template <class SVC_HANDLER> void +ACE_Reactive_Strategy<SVC_HANDLER>::dump (void) const +{ + ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::dump"); +} + +template <class SVC_HANDLER> int +ACE_Reactive_Strategy<SVC_HANDLER>::open (ACE_Reactor *reactor, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::open"); + this->reactor_ = reactor; + this->mask_ = mask; + + // Must have a <Reactor> + if (this->reactor_ == 0) + return -1; + else + return 0; +} + +template <class SVC_HANDLER> +ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (ACE_Reactor *reactor, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy"); + + if (this->open (reactor, mask) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", + "ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy")); +} + +template <class SVC_HANDLER> +ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy (void) + : reactor_ (0), + mask_ (ACE_Event_Handler::NULL_MASK) +{ + ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy"); +} + +template <class SVC_HANDLER> +ACE_Reactive_Strategy<SVC_HANDLER>::~ACE_Reactive_Strategy (void) +{ + ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::~ACE_Reactive_Strategy"); +} + +template <class SVC_HANDLER> int +ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *svc_handler, + void *arg) +{ + ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler"); + + if (this->reactor_ == 0) + return -1; + else if (this->reactor_->register_handler (svc_handler, this->mask_) == -1) + return -1; + // Call up to our parent to do the SVC_HANDLER initialization. + else if (this->inherited::activate_svc_handler (svc_handler, arg) == -1) + { + // Make sure to remove the <svc_handler> from the <Reactor>. + this->reactor_->remove_handler (svc_handler, this->mask_); + return -1; + } + else + return 0; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy) + +template <class SVC_HANDLER> void ACE_Thread_Strategy<SVC_HANDLER>::dump (void) const { ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::dump"); @@ -210,8 +279,8 @@ ACE_Thread_Strategy<SVC_HANDLER>::dump (void) const template <class SVC_HANDLER> int ACE_Thread_Strategy<SVC_HANDLER>::open (ACE_Thread_Manager *thr_mgr, - long thr_flags, - int n_threads) + long thr_flags, + size_t n_threads) { ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::open"); this->thr_mgr_ = thr_mgr; @@ -228,11 +297,14 @@ ACE_Thread_Strategy<SVC_HANDLER>::open (ACE_Thread_Manager *thr_mgr, template <class SVC_HANDLER> ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy (ACE_Thread_Manager *thr_mgr, - long thr_flags, - int n_threads) + long thr_flags, + size_t n_threads) { ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy"); - this->open (thr_mgr, thr_flags, n_threads); + + if (this->open (thr_mgr, thr_flags, n_threads) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", + "ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy")); } template <class SVC_HANDLER> diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h index 66947c5b943..268a3e64a9c 100644 --- a/ace/Strategies_T.h +++ b/ace/Strategies_T.h @@ -59,6 +59,7 @@ public: protected: ACE_Thread_Manager *thr_mgr_; + // Pointer to a thread manager. }; template <class SVC_HANDLER> @@ -182,6 +183,55 @@ public: }; template <class SVC_HANDLER> +class ACE_Reactive_Strategy : public ACE_Concurrency_Strategy <SVC_HANDLER> + // = TITLE + // Defines the interface for specifying a Reactive concurrency + // strategy for a SVC_HANDLER. + // + // = DESCRIPTION + // This class provides a strategy that registers the + // <SVC_HANDLER> with a <Reactor>. +{ +public: + // = Intialization and termination methods. + ACE_Reactive_Strategy (void); + // "Do-nothing constructor" + + ACE_Reactive_Strategy (ACE_Reactor *reactor, + ACE_Reactor_Mask = ACE_Event_Handler::READ_MASK); + // Initialize the strategy. + + virtual int open (ACE_Reactor *reactor, + ACE_Reactor_Mask = ACE_Event_Handler::READ_MASK); + // Initialize the strategy. + + virtual ~ACE_Reactive_Strategy (void); + // Destructor. + + // = Factory method. + virtual int activate_svc_handler (SVC_HANDLER *svc_handler, + void *arg = 0); + // Activate the <svc_handler> by registering it with the <Reactor> + // and then calling it's <open> hook. + + void dump (void) const; + // Dump the state of an object. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + typedef ACE_Concurrency_Strategy<SVC_HANDLER> inherited; + + ACE_Reactor *reactor_; + // Pointer to the Reactor we'll use to register the <SVC_HANDLER>. + + ACE_Reactor_Mask mask_; + // The mask that we pass to the <Reactor> when we register the + // <SVC_HANDLER>. +}; + +template <class SVC_HANDLER> class ACE_Thread_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER> // = TITLE // Defines the interface for specifying a concurrency strategy @@ -201,12 +251,12 @@ public: ACE_Thread_Strategy (ACE_Thread_Manager *tm, long thr_flags, - int n_threads = 1); + size_t n_threads = 1); // Initialize the strategy. virtual int open (ACE_Thread_Manager *tm, long thr_flags, - int n_threads = 1); + size_t n_threads = 1); // Initialize the strategy. virtual ~ACE_Thread_Strategy (void); @@ -234,7 +284,7 @@ protected: long thr_flags_; // Flags to pass into the SVC_HANDLER::activate() method. - int n_threads_; + size_t n_threads_; // Number of threads to spawn. }; diff --git a/ace/config-sunos5.4-centerline-2.x.h b/ace/config-sunos5.4-centerline-2.x.h index 476ddd27a00..0bf46dc40e0 100644 --- a/ace/config-sunos5.4-centerline-2.x.h +++ b/ace/config-sunos5.4-centerline-2.x.h @@ -7,6 +7,8 @@ #if !defined (ACE_CONFIG_H) #define ACE_CONFIG_H +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // Platform supports pread() and pwrite() #define ACE_HAS_P_READ_WRITE diff --git a/ace/config-sunos5.4-g++.h b/ace/config-sunos5.4-g++.h index 88cddd8883f..959634ad222 100644 --- a/ace/config-sunos5.4-g++.h +++ b/ace/config-sunos5.4-g++.h @@ -11,6 +11,8 @@ #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // Platform supports pread() and pwrite() #define ACE_HAS_P_READ_WRITE diff --git a/ace/config-sunos5.4-sunc++-4.x-orbix.h b/ace/config-sunos5.4-sunc++-4.x-orbix.h index 7440259a167..21f0884629c 100644 --- a/ace/config-sunos5.4-sunc++-4.x-orbix.h +++ b/ace/config-sunos5.4-sunc++-4.x-orbix.h @@ -12,6 +12,8 @@ #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // Platform supports pread() and pwrite() #define ACE_HAS_P_READ_WRITE diff --git a/ace/config-sunos5.4-sunc++-4.x.h b/ace/config-sunos5.4-sunc++-4.x.h index 57e7d71db2b..84ca416abe2 100644 --- a/ace/config-sunos5.4-sunc++-4.x.h +++ b/ace/config-sunos5.4-sunc++-4.x.h @@ -11,6 +11,8 @@ #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // Platform supports pread() and pwrite() #define ACE_HAS_P_READ_WRITE diff --git a/ace/config-sunos5.5-g++.h b/ace/config-sunos5.5-g++.h index 461c33e3551..d8ef2d603f1 100644 --- a/ace/config-sunos5.5-g++.h +++ b/ace/config-sunos5.5-g++.h @@ -11,6 +11,8 @@ #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // ACE_HAS_EXCEPTIONS requires -fhandle-exceptions, but that gives // g++ 2.7.2 fits: it spits out all kinds of warnings that it doesn't // without that option (and that are just wrong), and runs out of diff --git a/ace/config-sunos5.5-sunc++-4.1.h b/ace/config-sunos5.5-sunc++-4.1.h index b089b9141ed..8aaceb190d3 100644 --- a/ace/config-sunos5.5-sunc++-4.1.h +++ b/ace/config-sunos5.5-sunc++-4.1.h @@ -14,6 +14,8 @@ #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // ACE_HAS_EXCEPTIONS precludes -noex, but without -noex causes problems // with Sun C++ 4.1/4.2 on multiprocessor UltraSparcs: threaded // executables core dump when threads exit. This problem does not seem diff --git a/ace/config-sunos5.5-sunc++-4.x-orbix.h b/ace/config-sunos5.5-sunc++-4.x-orbix.h index dbfbd6bce0e..2613ece6d0f 100644 --- a/ace/config-sunos5.5-sunc++-4.x-orbix.h +++ b/ace/config-sunos5.5-sunc++-4.x-orbix.h @@ -13,6 +13,8 @@ #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // until we can trust exception handling with Sun C++, it's not enabled . . . // #define ACE_HAS_EXCEPTIONS diff --git a/ace/config-sunos5.5-sunc++-4.x.h b/ace/config-sunos5.5-sunc++-4.x.h index 066e79a593a..8879ec69669 100644 --- a/ace/config-sunos5.5-sunc++-4.x.h +++ b/ace/config-sunos5.5-sunc++-4.x.h @@ -14,6 +14,8 @@ // until we can trust exception handling with Sun C++, it's not enabled . . . // #define ACE_HAS_EXCEPTIONS +#define ACE_HAS_TEMPLATE_SPECIALIZATION + // Platform supports pread() and pwrite() #define ACE_HAS_P_READ_WRITE |