summaryrefslogtreecommitdiff
path: root/ace/Future_Set.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-30 00:19:39 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-30 00:19:39 +0000
commitfc1741beac39b5b1097d945430a3e08cef202eb3 (patch)
treee4adeac635d64faf2b22f588c3d176a7d7037d6b /ace/Future_Set.cpp
parente095b1fde01638d3d95733e2bbe15898d92b6a98 (diff)
downloadATCD-fc1741beac39b5b1097d945430a3e08cef202eb3.tar.gz
Tue Jun 29 18:48:22 1999 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'ace/Future_Set.cpp')
-rw-r--r--ace/Future_Set.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/ace/Future_Set.cpp b/ace/Future_Set.cpp
index 4fd3c5d7a89..6f98b36aede 100644
--- a/ace/Future_Set.cpp
+++ b/ace/Future_Set.cpp
@@ -16,7 +16,7 @@ ACE_RCSID(ace, Future_Set, "$Id$")
#if defined (ACE_HAS_THREADS)
-template <class T>
+ template <class T>
ACE_Future_Set<T>::ACE_Future_Set (ACE_Message_Queue<ACE_SYNCH> *new_queue)
: delete_queue_ (0)
{
@@ -38,16 +38,14 @@ ACE_Future_Set<T>::ACE_Future_Set (const ACE_Future_Set<T> &r)
template <class T>
ACE_Future_Set<T>::~ACE_Future_Set (void)
{
- FUTURE_ENTRY *map_entry = 0;
-
- // Detach ourselves from all remaining futures, if any,
- // in our map.
-
- for (FUTURE_ITERATOR map_iterator (this->future_map_);
- map_iterator.next (map_entry) != 0;
- map_iterator.advance ())
+ // Detach ourselves from all remaining futures, if any, in our map.
+ FUTURE_HASH_MAP::iterator iterator = this->future_map_.begin ();
+ FUTURE_HASH_MAP::iterator end = this->future_map_.end ();
+ for (;
+ iterator != end;
+ ++iterator)
{
- FUTURE_HOLDER *future_holder = map_entry->int_id_;
+ FUTURE_HOLDER *future_holder = (*iterator).int_id_;
future_holder->item_.detach (this);
delete future_holder;
}
@@ -59,7 +57,7 @@ ACE_Future_Set<T>::~ACE_Future_Set (void)
template <class T> int
ACE_Future_Set<T>::is_empty () const
{
- return this->future_map_.current_size () == 0;
+ return ( ((ACE_Future_Set<T>*)this)->future_map_.current_size () == 0 );
}
template <class T> int
@@ -70,13 +68,14 @@ ACE_Future_Set<T>::insert (ACE_Future<T> &future)
FUTURE_HOLDER (future),
-1);
- int result = this->future_map_.bind (future.get_rep (),
+ FUTURE_REP *future_rep = future.get_rep ();
+ int result = this->future_map_.bind (future_rep,
future_holder);
- // If a new map entry was created, then attach to the future,
- // otherwise we were already attached to the future or some error
- // occurred so just delete the future holder.
- if (result == 0)
+ // If a new map entry was created, then attach to the future, otherwise
+ // we were already attached to the future or some error occurred so just
+ // delete the future holder.
+ if ( result == 0 )
// Attach ourself to the ACE_Futures list of observer
future.attach (this);
else
@@ -89,9 +88,10 @@ template <class T> void
ACE_Future_Set<T>::update (const ACE_Future<T> &future)
{
ACE_Message_Block *mb;
- FUTURE localFuture = future;
+ FUTURE local_future = future;
+
ACE_NEW (mb,
- ACE_Message_Block ((char *) localFuture.get_rep (), 0));
+ ACE_Message_Block ((char *) local_future.get_rep (), 0));
// Enqueue in priority order.
this->future_notification_queue_->enqueue (mb, 0);
@@ -105,7 +105,7 @@ ACE_Future_Set<T>::next_readable (ACE_Future<T> &future,
return 0;
ACE_Message_Block *mb;
- FUTURE_REP *future_rep;
+ FUTURE_REP *future_rep = 0;
// Wait for a "readable future" signal from the message queue.
if (this->future_notification_queue_->dequeue_head (mb,
@@ -124,9 +124,8 @@ ACE_Future_Set<T>::next_readable (ACE_Future<T> &future,
// Remove the hash map entry with the specified future rep from our map.
FUTURE_HOLDER *future_holder;
-
- if (this->future_map_.find (future_rep,
- future_holder) != -1)
+ if ( this->future_map_.find (future_rep,
+ future_holder) != -1 )
{
future = future_holder->item_;
this->future_map_.unbind (future_rep);