diff options
author | harrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-11 17:27:43 +0000 |
---|---|---|
committer | harrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-11 17:27:43 +0000 |
commit | c093aae01307aa5533b9ca71fba917dcc60dc228 (patch) | |
tree | 43d314ddc9a020386b091f5d2a612b739a2348dd /ace/Message_Queue.cpp | |
parent | 5775a34fcd97b20329890c5ee8ff64f03d08fa9c (diff) | |
download | ATCD-c093aae01307aa5533b9ca71fba917dcc60dc228.tar.gz |
Reverted changes to enqueue methods so that lock is released before
notify is called.
Diffstat (limited to 'ace/Message_Queue.cpp')
-rw-r--r-- | ace/Message_Queue.cpp | 157 |
1 files changed, 82 insertions, 75 deletions
diff --git a/ace/Message_Queue.cpp b/ace/Message_Queue.cpp index 61719c811ac..0e0f7a38cf0 100644 --- a/ace/Message_Queue.cpp +++ b/ace/Message_Queue.cpp @@ -467,33 +467,35 @@ ACE_Message_Queue<ACE_SYNCH_2>::enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *tv) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::enqueue_head"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); int queue_count; - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - - // Wait while the queue is full - - while (this->is_full_i ()) - { - if (this->notfull_cond_.wait (tv) == -1) - { - if (errno == ETIME) - errno = EWOULDBLOCK; - return -1; - } - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - } - - queue_count = this->enqueue_head_i (new_item); + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } + + // Wait while the queue is full + + while (this->is_full_i ()) + { + if (this->notfull_cond_.wait (tv) == -1) + { + if (errno == ETIME) + errno = EWOULDBLOCK; + return -1; + } + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } + } + + queue_count = this->enqueue_head_i (new_item); + } if (queue_count == -1) return -1; @@ -513,34 +515,36 @@ ACE_Message_Queue<ACE_SYNCH_2>::enqueue_prio (ACE_Message_Block *new_item, ACE_Time_Value *tv) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::enqueue_prio"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); int queue_count; - - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - - // Wait while the queue is full - - while (this->is_full_i ()) - { - if (this->notfull_cond_.wait (tv) == -1) - { - if (errno == ETIME) - errno = EWOULDBLOCK; - return -1; - } - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - } - - queue_count = this->enqueue_i (new_item); + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); + + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } + + // Wait while the queue is full + + while (this->is_full_i ()) + { + if (this->notfull_cond_.wait (tv) == -1) + { + if (errno == ETIME) + errno = EWOULDBLOCK; + return -1; + } + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } + } + + queue_count = this->enqueue_i (new_item); + } if (queue_count == -1) return -1; @@ -567,33 +571,36 @@ ACE_Message_Queue<ACE_SYNCH_2>::enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *tv) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::enqueue_tail"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); int queue_count; - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - - // Wait while the queue is full - - while (this->is_full_i ()) - { - if (this->notfull_cond_.wait (tv) == -1) - { - if (errno == ETIME) - errno = EWOULDBLOCK; - return -1; - } - if (this->deactivated_) - { - errno = ESHUTDOWN; - return -1; - } - } - queue_count = this->enqueue_tail_i (new_item); + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); + + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } + + // Wait while the queue is full + + while (this->is_full_i ()) + { + if (this->notfull_cond_.wait (tv) == -1) + { + if (errno == ETIME) + errno = EWOULDBLOCK; + return -1; + } + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } + } + queue_count = this->enqueue_tail_i (new_item); + } if (queue_count == -1) return -1; |