summaryrefslogtreecommitdiff
path: root/ace/Future.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Future.cpp')
-rw-r--r--ace/Future.cpp48
1 files changed, 22 insertions, 26 deletions
diff --git a/ace/Future.cpp b/ace/Future.cpp
index e42c1bf99a4..f70f8df83bb 100644
--- a/ace/Future.cpp
+++ b/ace/Future.cpp
@@ -144,37 +144,33 @@ ACE_Future_Rep<T>::set (const T &r,
// If the value is already produced, ignore it...
if (this->value_ == 0)
{
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex,
- ace_mon,
- this->value_ready_mutex_,
- -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->value_ready_mutex_, -1));
// Otherwise, create a new result value. Note the use of the
// Double-checked locking pattern to avoid multiple allocations.
- if (this->value_ == 0) // Still no value, so proceed
+ if (this->value_ == 0)
+ ACE_NEW_RETURN (this->value_,
+ T (r),
+ -1);
+
+ // Remove and notify all subscribed observers.
+ ACE_TYPENAME OBSERVER_COLLECTION::iterator iterator =
+ this->observer_collection_.begin ();
+
+ ACE_TYPENAME OBSERVER_COLLECTION::iterator end =
+ this->observer_collection_.end ();
+
+ for (;
+ iterator != end;
+ ++iterator)
{
- ACE_NEW_RETURN (this->value_,
- T (r),
- -1);
-
- // Remove and notify all subscribed observers.
- ACE_TYPENAME OBSERVER_COLLECTION::iterator iterator =
- this->observer_collection_.begin ();
-
- ACE_TYPENAME OBSERVER_COLLECTION::iterator end =
- this->observer_collection_.end ();
-
- for (;
- iterator != end;
- ++iterator)
- {
- OBSERVER *observer = *iterator;
- observer->update (caller);
- }
-
- // Signal all the waiting threads.
- return this->value_ready_.broadcast ();
+ OBSERVER *observer = *iterator;
+ observer->update (caller);
}
+
+ // Signal all the waiting threads.
+ return this->value_ready_.broadcast ();
+
// Destructor releases the lock.
}
return 0;