diff options
author | harrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-11 19:01:39 +0000 |
---|---|---|
committer | harrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-11 19:01:39 +0000 |
commit | 3a776397275e1230b092e2dac39becea365f6dbe (patch) | |
tree | 1dd3bb2c70c7ec813dfc2168087d24e44ef5ffd3 /ace/Message_Queue.cpp | |
parent | c093aae01307aa5533b9ca71fba917dcc60dc228 (diff) | |
download | ATCD-3a776397275e1230b092e2dac39becea365f6dbe.tar.gz |
Once again, enqueue methods changed to hold the lock during notify calls.
Diffstat (limited to 'ace/Message_Queue.cpp')
-rw-r--r-- | ace/Message_Queue.cpp | 158 |
1 files changed, 76 insertions, 82 deletions
diff --git a/ace/Message_Queue.cpp b/ace/Message_Queue.cpp index 0e0f7a38cf0..436fa7f7c49 100644 --- a/ace/Message_Queue.cpp +++ b/ace/Message_Queue.cpp @@ -467,35 +467,34 @@ 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; - { - 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 (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; @@ -515,36 +514,34 @@ 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; - { - 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 (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; @@ -571,36 +568,33 @@ 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; - { - 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 (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; |