diff options
-rw-r--r-- | ChangeLog-99b | 19 | ||||
-rw-r--r-- | THANKS | 9 | ||||
-rw-r--r-- | ace/Acceptor.cpp | 38 | ||||
-rw-r--r-- | ace/Message_Queue.h | 10 | ||||
-rw-r--r-- | ace/Message_Queue_T.cpp | 59 | ||||
-rw-r--r-- | ace/Message_Queue_T.h | 42 |
6 files changed, 114 insertions, 63 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index ee9572760e7..cf31412d1e1 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,22 @@ +Thu Jul 22 20:03:54 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * ace/Acceptor.cpp: For sanity's sake, initialize all the data + members to 0 in the ACE_Strategy_Acceptor constructor. Thanks + to Jody Hagins <jody@atdesk.com> for reporting this. + + * ace/Acceptor.cpp: The service_port_ data member in the + ACE_Strategy_Acceptor wasn't being initialized to 0. Thanks to + Jody Hagins <jody@atdesk.com> for reporting this. + + * ace/Acceptor.cpp: Modified the dump() and info() methods so that + don't do bad things if service_name_ and service_description_ + are NULL. Thanks to Jody Hagins <jody@atdesk.com> for this + suggestion. + + * ace/Message_Queue_T.h: Clarified what the errnos get set to when + timeouts occur or queues are deactivated. Thanks to + John Forest <forestj@res.raytheon.com> for suggesting this. + Thu Jul 22 16:55:14 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * ace/Stats.cpp: @@ -694,12 +694,13 @@ Erik Johannes <ejohannes@oresis.com> Alex Hornby <alex@anvil.co.uk> Riaz Syed <syed@Lynx.COM> Clarence M. Weaver <clarence_m_weaver@md.northgrum.com> +John Forest <forestj@res.raytheon.com> I would particularly like to thank Paul Stephenson, who worked with me -at Ericsson and is now at ObjectSpace. Paul devised the recursive -Makefile scheme that underlies this distribution and also spent -countless hours with me discussing object-oriented techniques for -developing distributed application frameworks. +at Ericsson. Paul devised the recursive Makefile scheme that +underlies this distribution and also spent countless hours with me +discussing object-oriented techniques for developing distributed +application frameworks. Finally, I'd also like to thank Todd L. Montgomery <tmont@cs.wvu.edu>, fellow heavy metal head, for fulfilling his quest to get ACE to diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index 440987e7e41..49cd1b525e5 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -422,16 +422,18 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::dump (); this->creation_strategy_->dump (); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_creation_strategy_ = %d"), delete_creation_strategy_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_creation_strategy_ = %d"), delete_creation_strategy_)); this->accept_strategy_->dump (); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_accept_strategy_ = %d"), delete_accept_strategy_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_accept_strategy_ = %d"), delete_accept_strategy_)); this->concurrency_strategy_->dump (); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_concurrency_strategy_ = %d"), delete_concurrency_strategy_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_concurrency_strategy_ = %d"), delete_concurrency_strategy_)); this->scheduling_strategy_->dump (); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_scheduling_strategy_ = %d"), delete_scheduling_strategy_)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nservice_name_ = %s"), this->service_name_)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nservice_description_ = %s"), this->service_description_)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nservice_port_ = %d"), this->service_port_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("delete_scheduling_strategy_ = %d"), delete_scheduling_strategy_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nservice_name_ = %s"), + this->service_name_ == 0 ? ASYS_TEXT ("<unknown>") : this->service_name_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nservice_description_ = %s"), + this->service_description_ == 0 ? ASYS_TEXT ("<unknown>") : this->service_description_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nservice_port_ = %d"), this->service_port_)); this->service_addr_.dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } @@ -565,7 +567,8 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Strategy_Acceptor scheduling_strategy_ (0), delete_scheduling_strategy_ (0), service_name_ (0), - service_description_ (0) + service_description_ (0), + service_port_ (0) { ACE_TRACE ("ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Strategy_Acceptor"); @@ -589,6 +592,17 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Strategy_Acceptor const ASYS_TCHAR service_name[], const ASYS_TCHAR service_description[], int use_select) + : creation_strategy_ (0), + delete_creation_strategy_ (0), + accept_strategy_ (0), + delete_accept_strategy_ (0), + concurrency_strategy_ (0), + delete_concurrency_strategy_ (0), + scheduling_strategy_ (0), + delete_scheduling_strategy_ (0), + service_name_ (0), + service_description_ (0), + service_port_ (0) { ACE_TRACE ("ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Strategy_Acceptor"); @@ -735,9 +749,13 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::info (ASYS_TCHAR **strp // @@ Should add the protocol in... ACE_OS::sprintf (buf, ASYS_TEXT ("%s\t %s #%s\n"), - this->service_name_, + this->service_name_ == 0 + ? ASYS_TEXT ("<unknown>") + : this->service_name_, service_addr_str, - this->service_description_); + this->service_description_ == 0 + ? ASYS_TEXT ("<unknown>") + : this->service_description_); if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) return -1; diff --git a/ace/Message_Queue.h b/ace/Message_Queue.h index fc11dde4a3e..b251e62cd0d 100644 --- a/ace/Message_Queue.h +++ b/ace/Message_Queue.h @@ -153,22 +153,22 @@ class ACE_Message_Queue_Vx : public ACE_Message_Queue<ACE_NULL_SYNCH> // // NOTE: *Many* ACE_Message_Queue features are not supported with // this specialization, including: - // * The two size arguments to the constructor and open () are + // * The two size arguments to the constructor and <open> are // interpreted differently. The first is interpreted as the // maximum number of bytes in a message. The second is // interpreted as the maximum number of messages that can be // queued. - // * dequeue_head () *requires* that the ACE_Message_Block + // * <dequeue_head> *requires* that the ACE_Message_Block // pointer argument point to an ACE_Message_Block that was // allocated by the caller. It must be big enough to support // the received message, without using continutation. The // pointer argument is not modified. // * Message priority. MSG_Q_FIFO is hard-coded. // * enqueue method timeouts. - // * peek_dequeue_head (). - // * ACE_Message_Queue_Iterators. + // * <peek_dequeue_head>. + // * <ACE_Message_Queue_Iterators>. // * The ability to change low and high water marks after creation. - // * Message_Block chains. The continuation field of ACE_Message_Block + // * <Message_Block> chains. The continuation field of <ACE_Message_Block> // * is ignored; only the first block of a fragment chain is // * recognized. public: diff --git a/ace/Message_Queue_T.cpp b/ace/Message_Queue_T.cpp index e77eef128ba..46b14d8978e 100644 --- a/ace/Message_Queue_T.cpp +++ b/ace/Message_Queue_T.cpp @@ -705,58 +705,53 @@ ACE_Message_Queue<ACE_SYNCH_USE>::notify (void) } -///////////////////////////////////// -// class ACE_Dynamic_Message_Queue // -///////////////////////////////////// - - // = Initialization and termination methods. +// = Initialization and termination methods. template <ACE_SYNCH_DECL> -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::ACE_Dynamic_Message_Queue ( - ACE_Dynamic_Message_Strategy & message_strategy, - size_t hwm, - size_t lwm, - ACE_Notification_Strategy *ns) - : ACE_Message_Queue<ACE_SYNCH_USE> (hwm, lwm, ns) - , pending_head_ (0) - , pending_tail_ (0) - , late_head_ (0) - , late_tail_ (0) - , beyond_late_head_ (0) - , beyond_late_tail_ (0) - , message_strategy_ (message_strategy) +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::ACE_Dynamic_Message_Queue (ACE_Dynamic_Message_Strategy & message_strategy, + size_t hwm, + size_t lwm, + ACE_Notification_Strategy *ns) + : ACE_Message_Queue<ACE_SYNCH_USE> (hwm, lwm, ns), + pending_head_ (0), + pending_tail_ (0), + late_head_ (0), + late_tail_ (0), + beyond_late_head_ (0), + beyond_late_tail_ (0), + message_strategy_ (message_strategy) { - // note, the ACE_Dynamic_Message_Queue assumes full responsibility for the - // passed ACE_Dynamic_Message_Strategy object, and deletes it in its own dtor + // Note, the ACE_Dynamic_Message_Queue assumes full responsibility + // for the passed ACE_Dynamic_Message_Strategy object, and deletes + // it in its own dtor } +// dtor: free message strategy and let base class dtor do the rest. + template <ACE_SYNCH_DECL> ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::~ACE_Dynamic_Message_Queue (void) { - delete &(this->message_strategy_); + delete &this->message_strategy_; } -// dtor: free message strategy and let base class dtor do the rest template <ACE_SYNCH_DECL> int ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::remove_messages (ACE_Message_Block *&list_head, ACE_Message_Block *&list_tail, u_int status_flags) { - int result = 0; - // start with an empty list list_head = 0; list_tail = 0; - - // get the current time + // Get the current time ACE_Time_Value current_time = ACE_OS::gettimeofday (); - // refresh priority status boundaries in the queue - result = this->refresh_queue (current_time); + // Refresh priority status boundaries in the queue. + int result = this->refresh_queue (current_time); if (result < 0) return result; - if ((status_flags & (u_int) ACE_Dynamic_Message_Strategy::PENDING) + if (ACE_BIT_ENABLED (status_flags, + (u_int) ACE_Dynamic_Message_Strategy::PENDING) && this->pending_head_ && this->pending_tail_) { @@ -783,7 +778,8 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::remove_messages (ACE_Message_Block *&l this->pending_tail_ = 0; } - if ((status_flags & (u_int) ACE_Dynamic_Message_Strategy::LATE) + if (ACE_BIT_ENABLED (status_flags, + (u_int) ACE_Dynamic_Message_Strategy::LATE) && this->late_head_ && this->late_tail_) { @@ -813,7 +809,8 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::remove_messages (ACE_Message_Block *&l this->late_tail_ = 0; } - if ((status_flags & (u_int) ACE_Dynamic_Message_Strategy::BEYOND_LATE) + if (ACE_BIT_ENABLED (status_flags, + (u_int) ACE_Dynamic_Message_Strategy::BEYOND_LATE) && this->beyond_late_head_ && this->beyond_late_tail_) { diff --git a/ace/Message_Queue_T.h b/ace/Message_Queue_T.h index 90484d98a28..bbf0a4cd182 100644 --- a/ace/Message_Queue_T.h +++ b/ace/Message_Queue_T.h @@ -106,10 +106,13 @@ public: virtual int peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout = 0); - // Retrieve the first <ACE_Message_Block> without removing it. - // Returns -1 on failure, else the number of items still on the - // queue. Note that <timeout> uses <{absolute}> time rather than - // <{relative}> time. + // Retrieve the first <ACE_Message_Block> without removing it. Note + // that <timeout> uses <{absolute}> time rather than <{relative}> + // time. If the <timeout> elapses without receiving a message -1 is + // returned and <errno> is set to <EWOULDBLOCK>. If the queue is + // deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. + // Otherwise, returns -1 on failure, else the number of items still + // on the queue. virtual int enqueue_prio (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); @@ -117,8 +120,11 @@ public: // accordance with its <msg_priority> (0 is lowest priority). FIFO // order is maintained when messages of the same priority are // inserted consecutively. Note that <timeout> uses <{absolute}> - // time rather than <{relative}> time. Returns -1 on failure, else - // the number of items still on the queue. + // time rather than <{relative}> time. If the <timeout> elapses + // without receiving a message -1 is returned and <errno> is set to + // <EWOULDBLOCK>. If the queue is deactivated -1 is returned and + // <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, + // else the number of items still on the queue. virtual int enqueue (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); @@ -131,25 +137,35 @@ public: ACE_Time_Value *timeout = 0); // Enqueue an <ACE_Message_Block *> at the end of the queue. Note // that <timeout> uses <{absolute}> time rather than <{relative}> - // time. Returns -1 on failure, else the number of items still on - // the queue. + // time. If the <timeout> elapses without receiving a message -1 is + // returned and <errno> is set to <EWOULDBLOCK>. If the queue is + // deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. + // Otherwise, returns -1 on failure, else the number of items still + // on the queue. virtual int enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); // Enqueue an <ACE_Message_Block *> at the head of the queue. Note // that <timeout> uses <{absolute}> time rather than <{relative}> - // time. Returns -1 on failure, else the number of items still on - // the queue. + // time. If the <timeout> elapses without receiving a message -1 is + // returned and <errno> is set to <EWOULDBLOCK>. If the queue is + // deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. + // Otherwise, returns -1 on failure, else the number of items still + // on the queue. virtual int dequeue (ACE_Message_Block *&first_item, ACE_Time_Value *timeout = 0); - // This method is an alias for the following method: + // This method is an alias for the following <dequeue_head> method. + virtual int dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout = 0); // Dequeue and return the <ACE_Message_Block *> at the head of the // queue. Note that <timeout> uses <{absolute}> time rather than - // <{relative}> time. Returns -1 on failure, else the number of - // items still on the queue. + // <{relative}> time. If the <timeout> elapses without receiving a + // message -1 is returned and <errno> is set to <EWOULDBLOCK>. If + // the queue is deactivated -1 is returned and <errno> is set to + // <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number + // of items still on the queue. // = Check if queue is full/empty. virtual int is_full (void); |