diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-02 09:05:39 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-02 09:05:39 +0000 |
commit | 1c44106287219a05ddbff09df4574b90777040ae (patch) | |
tree | 1d371fe6828480e7cecdcb75a8887a2b4bb83f53 /ace | |
parent | fbcfcdb6ff9975a9e2152be0a5dc7e28a32635fc (diff) | |
download | ATCD-1c44106287219a05ddbff09df4574b90777040ae.tar.gz |
foo
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 6 | ||||
-rw-r--r-- | ace/Acceptor.cpp | 18 | ||||
-rw-r--r-- | ace/Event_Handler.cpp | 8 | ||||
-rw-r--r-- | ace/Event_Handler.h | 22 | ||||
-rw-r--r-- | ace/Message_Block.cpp | 13 | ||||
-rw-r--r-- | ace/Message_Block.h | 6 | ||||
-rw-r--r-- | ace/OS.h | 12 | ||||
-rw-r--r-- | ace/Reactor.cpp | 11 | ||||
-rw-r--r-- | ace/Service_Manager.cpp | 4 | ||||
-rw-r--r-- | ace/Svc_Handler.cpp | 4 | ||||
-rw-r--r-- | ace/Task.cpp | 18 | ||||
-rw-r--r-- | ace/Task.h | 10 | ||||
-rw-r--r-- | ace/Task.i | 29 |
13 files changed, 94 insertions, 67 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 207dd5c805e..dc3177ed5c4 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -19,9 +19,9 @@ ACE::register_stdin_handler (ACE_Event_Handler *eh, return thr_mgr->spawn (&ACE::read_adapter, eh, flags); #else // Keep compilers happy. - flags = flags; - thr_mgr = thr_mgr; - reactor = reactor; + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (thr_mgr); + ACE_UNUSED_ARG (reactor); return reactor->register_handler (ACE_STDIN, eh, ACE_Event_Handler::READ_MASK); #endif /* ACE_WIN32 */ } diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index 10cd3306258..de394450352 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -68,7 +68,7 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open return -1; return this->reactor ()->register_handler - (this, ACE_Event_Handler::READ_MASK); + (this, ACE_Event_Handler::ACCEPT_MASK); } // Simple constructor. @@ -169,7 +169,7 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_close (ACE_HANDLE, // accept_strategy_... this->reactor_->remove_handler - (handle, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL); + (handle, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); // Shut down the listen socket to recycle the handles. if (this->peer_acceptor_.close () == -1) @@ -438,7 +438,7 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open this->scheduling_strategy_ = sch_s; return this->reactor ()->register_handler - (this, ACE_Event_Handler::READ_MASK); + (this, ACE_Event_Handler::ACCEPT_MASK); } // Simple constructor. @@ -520,7 +520,7 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_close (ACE_HANDL // accept_strategy_... this->reactor ()->remove_handler - (handle, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL); + (handle, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); // Set the Reactor to 0 so that we don't try to close down // again. @@ -711,7 +711,7 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_close (ACE_HANDLE if (this->reactor ()) this->reactor ()->remove_handler - (this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL); + (this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); if (this->peer_acceptor_.close () == -1) ACE_ERROR ((LM_ERROR, "close\n")); @@ -731,7 +731,7 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_timeout // Since we aren't necessarily registered with the Reactor, don't // bother to check the return value here... if (this->reactor ()) - this->reactor ()->remove_handler (this, ACE_Event_Handler::READ_MASK); + this->reactor ()->remove_handler (this, ACE_Event_Handler::ACCEPT_MASK); return 0; } @@ -763,8 +763,8 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::register_handler *tv) == 0) return -1; else - return this->reactor ()->register_handler (this, - ACE_Event_Handler::READ_MASK); + return this->reactor ()->register_handler + (this, ACE_Event_Handler::ACCEPT_MASK); } } @@ -869,7 +869,7 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input (ACE_HANDLE if (this->shared_accept (this->svc_handler_, 0, 0, this->restart_) == -1) result = -1; if (this->reactor () && this->reactor ()->remove_handler - (this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL) == -1) + (this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL) == -1) result = -1; return result; } diff --git a/ace/Event_Handler.cpp b/ace/Event_Handler.cpp index ef2fbdb9b64..2b9ec440911 100644 --- a/ace/Event_Handler.cpp +++ b/ace/Event_Handler.cpp @@ -46,18 +46,18 @@ ACE_Event_Handler::set_handle (ACE_HANDLE) // Gets the priority of this handler. int -ACE_Event_Handler::get_priority (void) const +ACE_Event_Handler::priority (void) const { - ACE_TRACE ("ACE_Event_Handler::get_priority"); + ACE_TRACE ("ACE_Event_Handler::priority"); return this->priority_; } // Sets the priority void -ACE_Event_Handler::set_priority (int priority) +ACE_Event_Handler::priority (int priority) { - ACE_TRACE ("ACE_Event_Handler::set_priority"); + ACE_TRACE ("ACE_Event_Handler::priority"); this->priority_ = priority; } diff --git a/ace/Event_Handler.h b/ace/Event_Handler.h index f414d930ed4..78166e921d4 100644 --- a/ace/Event_Handler.h +++ b/ace/Event_Handler.h @@ -43,20 +43,20 @@ public: { LO_PRIORITY = 0, HI_PRIORITY = 10, - NULL_MASK = 0, + NULL_MASK = 0, #if defined (ACE_USE_POLL) - READ_MASK = POLLIN, - WRITE_MASK = POLLOUT, + READ_MASK = POLLIN, + WRITE_MASK = POLLOUT, EXCEPT_MASK = POLLPRI, #else /* USE SELECT */ - READ_MASK = 0x1, - WRITE_MASK = 0x4, + READ_MASK = 0x1, + WRITE_MASK = 0x4, EXCEPT_MASK = 0x2, #endif /* ACE_USE_POLL */ ACCEPT_MASK = 0x8, - ALL_EVENTS_MASK = READ_MASK | WRITE_MASK | EXCEPT_MASK | ACCEPT_MASK, - RWE_MASK = ALL_EVENTS_MASK, - DONT_CALL = 0x100 + ALL_EVENTS_MASK = READ_MASK | WRITE_MASK | EXCEPT_MASK | ACCEPT_MASK, + RWE_MASK = ALL_EVENTS_MASK, + DONT_CALL = 0x100 }; virtual ~ACE_Event_Handler (void); @@ -70,9 +70,9 @@ public: // Set the I/O handle. // = Priority runs from MIN_PRIORITY (which is the "lowest priority") to MAX_PRIORITY (which is the "highest priority"). - virtual int get_priority (void) const; + virtual int priority (void) const; // Get the priority of the Event_Handler. - virtual void set_priority (int priority); + virtual void priority (int priority); // Set the priority of the Event_Handler. virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); @@ -89,7 +89,7 @@ public: const void *arg = 0); // Called when timer expires. - virtual int handle_close (ACE_HANDLE fd, + virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask); // Called when object is removed from the ACE_Reactor diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index d58e13a8c03..df4dc918cc6 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -114,7 +114,7 @@ ACE_Message_Block::~ACE_Message_Block (void) delete [] this->base_; } if (this->cont_) - delete this->cont_; + this->cont_->release (); this->prev_ = 0; this->next_ = 0; } @@ -316,7 +316,16 @@ ACE_Message_Block::release (void) return result; } -ACE_INLINE ACE_Message_Block * +/* static */ ACE_Message_Block * +ACE_Message_Block::release (ACE_Message_Block *mb) +{ + if (mb) + return mb->release (); + else + return 0; +} + +ACE_Message_Block * ACE_Message_Block::duplicate (void) { ACE_TRACE ("ACE_Message_Block::duplicate"); diff --git a/ace/Message_Block.h b/ace/Message_Block.h index 30852f4dc8c..ba1a760b2d1 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -165,6 +165,12 @@ public: // <this> and return 0. Behavior is undefined if reference count < // 0. + static ACE_Message_Block *release (ACE_Message_Block *mb); + // This behaves like the non-static method <release>, except that it + // checks if <mb> is 0. This is similar to <CORBA::release>, which + // is useful if you want to eliminate lots of checks for NULL + // pointers before calling <release> on them. Returns <mb>. + // = Operations on Message data int copy (const char *buf, size_t n); @@ -64,9 +64,17 @@ #define ACE_DEFAULT_THR_LOGGING_SERVER_PORT 10008 #define ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR "10008" +// Used for the gateway server. +#define ACE_DEFAULT_GATEWAY_SERVER_PORT 10009 +#define ACE_DEFAULT_GATEWAY_SERVER_PORT_STR "10009" + +// Used for the peer server. +#define ACE_DEFAULT_PEER_SERVER_PORT 10010 +#define ACE_DEFAULT_PEER_SERVER_PORT_STR "10010" + // Used for the time server. -#define ACE_DEFAULT_TIME_SERVER_PORT 10010 -#define ACE_DEFAULT_TIME_SERVER_PORT_STR "10010" +#define ACE_DEFAULT_TIME_SERVER_PORT 10011 +#define ACE_DEFAULT_TIME_SERVER_PORT_STR "10011" #define ACE_DEFAULT_TIME_SERVER_STR "ACE_TS_TIME" #define ACE_DEFAULT_SERVER_HOST "localhost" diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index c7a629d028b..335f8879edc 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -625,6 +625,7 @@ ACE_Reactor_Notify::handle_input (ACE_HANDLE handle) switch (buffer.mask_) { case ACE_Event_Handler::READ_MASK: + case ACE_Event_Handler::ACCEPT_MASK: result = buffer.eh_->handle_input (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::WRITE_MASK: @@ -1093,7 +1094,7 @@ ACE_Reactor::bit_ops (ACE_HANDLE handle, ACE_Sig_Guard sb; // Block out all signals until method returns. ACE_FDS_PTMF ptmf = &ACE_Handle_Set::set_bit; - u_long omask = ACE_Event_Handler::NULL_MASK; + u_long omask = ACE_Event_Handler::NULL_MASK; switch (ops) { @@ -1116,11 +1117,12 @@ ACE_Reactor::bit_ops (ACE_HANDLE handle, // The following code is rather subtle... Note that if we are // doing a ACE_Reactor::SET_MASK then if the bit is not enabled // in the mask we need to clear the bit from the ACE_Handle_Set. - // On the other hand, f we are doing a ACE_Reactor::CLR_MASK or + // On the other hand, if we are doing a ACE_Reactor::CLR_MASK or // a ACE_Reactor::ADD_MASK we just carry out the operations // specified by the mask. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) + || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) { (rd.*ptmf) (handle); ACE_SET_BITS (omask, ACE_Event_Handler::READ_MASK); @@ -1189,7 +1191,8 @@ ACE_Reactor::handler_i (ACE_HANDLE handle, return -1; else { - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) + if ((ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) + || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) && this->rd_handle_mask_.is_set (handle) == 0) return -1; if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK) diff --git a/ace/Service_Manager.cpp b/ace/Service_Manager.cpp index 834396dff1d..49564b0e30a 100644 --- a/ace/Service_Manager.cpp +++ b/ace/Service_Manager.cpp @@ -102,7 +102,7 @@ ACE_Service_Manager::init (int argc, char *argv[]) if (this->open (local_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); else if (ACE_Service_Config::reactor ()->register_handler - (this, ACE_Event_Handler::READ_MASK) == -1) + (this, ACE_Event_Handler::ACCEPT_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1); return 0; } @@ -119,7 +119,7 @@ ACE_Service_Manager::fini (void) { ACE_TRACE ("ACE_Service_Manager::fini"); return ACE_Service_Config::reactor ()->remove_handler - (this, ACE_Event_Handler::READ_MASK); + (this, ACE_Event_Handler::ACCEPT_MASK); } ACE_HANDLE diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp index 67855016c1a..33a507d7e4b 100644 --- a/ace/Svc_Handler.cpp +++ b/ace/Svc_Handler.cpp @@ -124,8 +124,8 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::open (void *) buf, this->peer_.get_handle ())); #endif /* DEBUGGING */ if (this->reactor () - && this->reactor ()->register_handler (this, - ACE_Event_Handler::READ_MASK) == -1) + && this->reactor ()->register_handler + (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p", "unable to register client handler"), -1); return 0; diff --git a/ace/Task.cpp b/ace/Task.cpp index a7626f52983..c93fb7e4822 100644 --- a/ace/Task.cpp +++ b/ace/Task.cpp @@ -123,24 +123,6 @@ ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man) { } -// Get the current group id. -int -ACE_Task_Base::grp_id (void) -{ - ACE_TRACE ("ACE_Task_Base::grp_id"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - return this->grp_id_; -} - -// Set the current group id. -void -ACE_Task_Base::grp_id (int id) -{ - ACE_TRACE ("ACE_Task_Base::grp_id"); - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); - this->grp_id_ = id; -} - // Suspend a task. int ACE_Task_Base::suspend (void) diff --git a/ace/Task.h b/ace/Task.h index 8e6f4752f27..9975f765220 100644 --- a/ace/Task.h +++ b/ace/Task.h @@ -103,25 +103,25 @@ public: virtual int resume (void); // Resume a suspended task. - int grp_id (void); + int grp_id (void) const; // Get the current group id. void grp_id (int); // Set the current group id. - ACE_Thread_Manager *thr_mgr (void); + ACE_Thread_Manager *thr_mgr (void) const; // Gets the thread manager associated with this Task. void thr_mgr (ACE_Thread_Manager *); // Set the thread manager associated with this Task. - int is_reader (void); + int is_reader (void) const; // True if queue is a reader, else false. - int is_writer (void); + int is_writer (void) const; // True if queue is a writer, else false. - size_t thr_count (void); + size_t thr_count (void) const; // Returns the number of threads currently running within a task. // If we're a passive object this value is 0, else it's > 0. diff --git a/ace/Task.i b/ace/Task.i index 7e682513761..798606a68ae 100644 --- a/ace/Task.i +++ b/ace/Task.i @@ -4,7 +4,7 @@ // Task.i ACE_INLINE ACE_Thread_Manager * -ACE_Task_Base::thr_mgr (void) +ACE_Task_Base::thr_mgr (void) const { ACE_TRACE ("ACE_Task_Base::thr_mgr"); return this->thr_mgr_; @@ -19,10 +19,10 @@ ACE_Task_Base::thr_mgr (ACE_Thread_Manager *thr_mgr) // Return the count of the current number of threads. ACE_INLINE size_t -ACE_Task_Base::thr_count (void) +ACE_Task_Base::thr_count (void) const { ACE_TRACE ("ACE_Task_Base::thr_count"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, 0)); return this->thr_count_; } @@ -39,14 +39,14 @@ ACE_Task_Base::thr_count_dec (void) } ACE_INLINE int -ACE_Task_Base::is_reader (void) +ACE_Task_Base::is_reader (void) const { ACE_TRACE ("ACE_Task_Base::is_reader"); return (ACE_BIT_ENABLED (this->flags_, ACE_Task_Flags::ACE_READER)); } ACE_INLINE int -ACE_Task_Base::is_writer (void) +ACE_Task_Base::is_writer (void) const { ACE_TRACE ("ACE_Task_Base::is_writer"); return (ACE_BIT_DISABLED (this->flags_, ACE_Task_Flags::ACE_READER)); @@ -87,3 +87,22 @@ ACE_Task_Base::put (ACE_Message_Block *, ACE_Time_Value *) ACE_TRACE ("ACE_Task_Base::put"); return 0; } + +// Get the current group id. +ACE_INLINE int +ACE_Task_Base::grp_id (void) const +{ + ACE_TRACE ("ACE_Task_Base::grp_id"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1)); + return this->grp_id_; +} + +// Set the current group id. +ACE_INLINE void +ACE_Task_Base::grp_id (int id) +{ + ACE_TRACE ("ACE_Task_Base::grp_id"); + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); + this->grp_id_ = id; +} + |