diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2002-05-06 10:32:08 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2002-05-06 10:32:08 +0000 |
commit | 74ecaa960b751aa81676279c3956daf7cebfbb59 (patch) | |
tree | 075b49ef10c3bb7d628ef2dce6702a5b52574c0b | |
parent | edcfe8b44577d51e8dc82b599a40cb4a77016eee (diff) | |
download | ATCD-74ecaa960b751aa81676279c3956daf7cebfbb59.tar.gz |
ChangeLogTag:Sun May 5 19:14:34 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 8 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 8 | ||||
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | ace/Acceptor.h | 2 | ||||
-rw-r--r-- | ace/Message_Queue_T.cpp | 102 | ||||
-rw-r--r-- | ace/Task_T.h | 2 |
7 files changed, 81 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog index 1861e7531cd..3907141971f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun May 5 19:14:34 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * ace/Message_Queue_T.cpp: Modified all the enqueue*() methods so that + their calls to notify() occur *outside* of the monitor lock. + This change prevents deadlock from occurring when a reactor's + notification pipe is full. Thanks to Sasha Agranov + <sagranov@COMGATES.co.il> for reporting this. + Mon May 6 10:24:12 2002 Johnny Willemsen <jwillemsen@remedy.nl> * apps/gperf/src/Makefile: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 1861e7531cd..3907141971f 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,11 @@ +Sun May 5 19:14:34 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * ace/Message_Queue_T.cpp: Modified all the enqueue*() methods so that + their calls to notify() occur *outside* of the monitor lock. + This change prevents deadlock from occurring when a reactor's + notification pipe is full. Thanks to Sasha Agranov + <sagranov@COMGATES.co.il> for reporting this. + Mon May 6 10:24:12 2002 Johnny Willemsen <jwillemsen@remedy.nl> * apps/gperf/src/Makefile: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 1861e7531cd..3907141971f 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,11 @@ +Sun May 5 19:14:34 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * ace/Message_Queue_T.cpp: Modified all the enqueue*() methods so that + their calls to notify() occur *outside* of the monitor lock. + This change prevents deadlock from occurring when a reactor's + notification pipe is full. Thanks to Sasha Agranov + <sagranov@COMGATES.co.il> for reporting this. + Mon May 6 10:24:12 2002 Johnny Willemsen <jwillemsen@remedy.nl> * apps/gperf/src/Makefile: @@ -1508,6 +1508,7 @@ Daniel Garrido <dgarrido@lcc.uma.es> Andy Alvarez <andy_alvarez@baxter.com> Soeren Gerlach <soeren.gerlach@gmx.de> Vitaly Prapirny <marl@mebius.net> +Sasha Agranov <sagranov@COMGATES.co.il> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ace/Acceptor.h b/ace/Acceptor.h index 63a448f1046..9a78fdf9945 100644 --- a/ace/Acceptor.h +++ b/ace/Acceptor.h @@ -79,7 +79,7 @@ public: * connection requests at the designated <local_addr>. <flags> * indicates how <SVC_HANDLER>'s should be initialized prior to * being activated. Right now, the only flag that is processed is - * <ACE_NONBLOCK>, which enabled non-blocking I/O on the + * <ACE_NONBLOCK>, which enables non-blocking I/O on the * <SVC_HANDLER> when it is opened. If <use_select> is non-zero * then <select> is used to determine when to break out of the * <accept> loop. <reuse_addr> is passed down to the diff --git a/ace/Message_Queue_T.cpp b/ace/Message_Queue_T.cpp index 3e2915f94da..06747d639d5 100644 --- a/ace/Message_Queue_T.cpp +++ b/ace/Message_Queue_T.cpp @@ -1199,21 +1199,23 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } - if (this->wait_not_full_cond (ace_mon, timeout) == -1) - return -1; + if (this->wait_not_full_cond (ace_mon, timeout) == -1) + return -1; - int queue_count = this->enqueue_head_i (new_item); + int queue_count = this->enqueue_head_i (new_item); - if (queue_count == -1) - return -1; + if (queue_count == -1) + return -1; + } this->notify (); return queue_count; @@ -1228,22 +1230,23 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - - if (this->wait_not_full_cond (ace_mon, timeout) == -1) - return -1; + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } - int queue_count = this->enqueue_i (new_item); + if (this->wait_not_full_cond (ace_mon, timeout) == -1) + return -1; - if (queue_count == -1) - return -1; + int queue_count = this->enqueue_i (new_item); + if (queue_count == -1) + return -1; + } this->notify (); return queue_count; } @@ -1257,22 +1260,23 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - - if (this->wait_not_full_cond (ace_mon, timeout) == -1) - return -1; + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } - int queue_count = this->enqueue_deadline_i (new_item); + if (this->wait_not_full_cond (ace_mon, timeout) == -1) + return -1; - if (queue_count == -1) - return -1; + int queue_count = this->enqueue_deadline_i (new_item); + if (queue_count == -1) + return -1; + } this->notify (); return queue_count; } @@ -1293,23 +1297,25 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } - if (this->wait_not_full_cond (ace_mon, timeout) == -1) - return -1; + if (this->wait_not_full_cond (ace_mon, timeout) == -1) + return -1; - int queue_count = this->enqueue_tail_i (new_item); + int queue_count = this->enqueue_tail_i (new_item); - if (queue_count == -1) - return -1; + if (queue_count == -1) + return -1; - this->notify (); + this->notify (); + } return queue_count; } @@ -1388,7 +1394,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail (ACE_Message_Block *&dequeued, template <ACE_SYNCH_DECL> int ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline (ACE_Message_Block *&dequeued, - ACE_Time_Value *timeout) + ACE_Time_Value *timeout) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); diff --git a/ace/Task_T.h b/ace/Task_T.h index cee09cb4dff..71964aaa0e1 100644 --- a/ace/Task_T.h +++ b/ace/Task_T.h @@ -122,7 +122,7 @@ public: // Should be protected: ACE_Module<ACE_SYNCH_USE> *module (void) const; /** - * Flush the queue, i.e., close it down and free all of the enqueued + * Flush the task's queue, i.e., free all of the enqueued * message blocks and releases any threads blocked on the queue. * Note that if this conflicts with the C++ iostream <flush> * function, just rewrite the iostream function as ::<flush>. |