summaryrefslogtreecommitdiff
path: root/ace/Message_Queue.cpp
diff options
context:
space:
mode:
authorharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-07-10 23:42:36 +0000
committerharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-07-10 23:42:36 +0000
commit870ac63c051c3fea0529e24c03810b046b893e80 (patch)
tree15785f02139776907a7ad10c9f2911233b5c2b7a /ace/Message_Queue.cpp
parent3cbf456bf0295aa5edcd1e16a9630085e2fc3611 (diff)
downloadATCD-870ac63c051c3fea0529e24c03810b046b893e80.tar.gz
Changed all the enqueue methods to hold onto the lock until the method
exits.
Diffstat (limited to 'ace/Message_Queue.cpp')
-rw-r--r--ace/Message_Queue.cpp158
1 files changed, 77 insertions, 81 deletions
diff --git a/ace/Message_Queue.cpp b/ace/Message_Queue.cpp
index 3e9bde4dc81..61719c811ac 100644
--- a/ace/Message_Queue.cpp
+++ b/ace/Message_Queue.cpp
@@ -470,32 +470,31 @@ ACE_Message_Queue<ACE_SYNCH_2>::enqueue_head (ACE_Message_Block *new_item,
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);
- }
+ 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;
else
@@ -514,37 +513,35 @@ 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;
else
@@ -570,35 +567,34 @@ 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;
else