#include <Future_Set.h>
Inheritance diagram for ACE_Future_Set< T >:
Definition at line 44 of file Future_Set.h.
|
Definition at line 106 of file Future_Set.h. Referenced by ACE_Future_Set< T >::update(). |
|
Definition at line 120 of file Future_Set.h. |
|
Definition at line 110 of file Future_Set.h. Referenced by ACE_Future_Set< T >::insert(), ACE_Future_Set< T >::next_readable(), and ACE_Future_Set< T >::~ACE_Future_Set(). |
|
Definition at line 108 of file Future_Set.h. |
|
Definition at line 114 of file Future_Set.h. |
|
Definition at line 112 of file Future_Set.h. |
|
Constructor.
Definition at line 17 of file Future_Set.cpp. References ACE_NEW, and ACE_Future_Set< T >::future_notification_queue_.
00018 : delete_queue_ (0) 00019 { 00020 if (new_queue) 00021 this->future_notification_queue_ = new_queue; 00022 else 00023 { 00024 ACE_NEW (this->future_notification_queue_, 00025 ACE_Message_Queue<ACE_SYNCH>); 00026 this->delete_queue_ = 1; 00027 } 00028 } |
|
Destructor.
Definition at line 31 of file Future_Set.cpp. References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), ACE_Future_Set< T >::FUTURE_HOLDER, ACE_Future_Set< T >::future_map_, ACE_Future_Set< T >::future_notification_queue_, and ACE_Future_Holder< T >::item_.
00032 { 00033 // Detach ourselves from all remaining futures, if any, in our map. 00034 ACE_TYPENAME FUTURE_HASH_MAP::iterator iterator = 00035 this->future_map_.begin (); 00036 00037 ACE_TYPENAME FUTURE_HASH_MAP::iterator end = 00038 this->future_map_.end (); 00039 00040 for (; 00041 iterator != end; 00042 ++iterator) 00043 { 00044 FUTURE_HOLDER *future_holder = (*iterator).int_id_; 00045 future_holder->item_.detach (this); 00046 delete future_holder; 00047 } 00048 00049 if (this->delete_queue_ != 0) 00050 delete this->future_notification_queue_; 00051 } |
|
|
|
Enqueus the given ACE_Future into this objects queue when it is readable. Returns 0 if the future is successfully inserted, 1 if the future is already inserted, and -1 if failures occur. Definition at line 60 of file Future_Set.cpp. References ACE_NEW_RETURN, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), ACE_Future_Set< T >::FUTURE_HOLDER, and ACE_Future_Set< T >::future_map_.
00061 { 00062 FUTURE_HOLDER *future_holder; 00063 ACE_NEW_RETURN (future_holder, 00064 FUTURE_HOLDER (future), 00065 -1); 00066 00067 FUTURE_REP *future_rep = future.get_rep (); 00068 int result = this->future_map_.bind (future_rep, 00069 future_holder); 00070 00071 // If a new map entry was created, then attach to the future, 00072 // otherwise we were already attached to the future or some error 00073 // occurred so just delete the future holder. 00074 if ( result == 0 ) 00075 // Attach ourself to the ACE_Futures list of observer 00076 future.attach (this); 00077 else 00078 delete future_holder; 00079 00080 return result; 00081 } |
|
Return 1 if their are no ACE_Future objects left on its queue and 0 otherwise. When an ACE_Future_Set has no ACE_Future>subjects to observe it is empty. The ACE_Future_Set is in the empty state when either the caller(s) have retrieved every readable ACE_Future subject assigned the ACE_Future_Set via the ACE_Future_Set::next_readable() method, or when the ACE_Future_Set has not been assigned any subjects. Definition at line 54 of file Future_Set.cpp. Referenced by ACE_Future_Set< T >::next_readable().
00055 { 00056 return (((ACE_Future_Set<T>*)this)->future_map_.current_size () == 0 ); 00057 } |
|
Wait up to time to get the . Note that must be specified in absolute time rather than relative time.); get the next ACE_Future that is readable. If = 0, the will block forever. If a readable future becomes available, then the input ACE_Future object param will be assigned with it and 1 will be returned. If the ACE_Future_Set is empty (i.e. see definition of ACE_Future_Set::is_empty()), then 0 is returned. When a readable ACE_Future object is retrieved via the ACE_Future_Set::next_readable() method, the ACE_Future_Set will remove that ACE_Future object from its list of subjects. Definition at line 97 of file Future_Set.cpp. References ACE_Message_Block::base(), ACE_Message_Queue< ACE_SYNCH >::dequeue_head(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), ACE_Future_Set< T >::FUTURE_HOLDER, ACE_Future_Set< T >::future_map_, ACE_Future_Set< T >::future_notification_queue_, ACE_Future_Set< T >::is_empty(), ACE_Future_Holder< T >::item_, ACE_Message_Block::release(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind().
00099 { 00100 if (this->is_empty ()) 00101 return 0; 00102 00103 ACE_Message_Block *mb = 0; 00104 FUTURE_REP *future_rep = 0; 00105 00106 // Wait for a "readable future" signal from the message queue. 00107 if (this->future_notification_queue_->dequeue_head (mb, 00108 tv) != -1) 00109 { 00110 // Extract future rep from the message block. 00111 future_rep = reinterpret_cast<FUTURE_REP *> (mb->base ()); 00112 00113 // Delete the message block. 00114 mb->release (); 00115 } 00116 else 00117 return 0; 00118 00119 // Remove the hash map entry with the specified future rep from our map. 00120 FUTURE_HOLDER *future_holder; 00121 if (this->future_map_.find (future_rep, 00122 future_holder) != -1) 00123 { 00124 future = future_holder->item_; 00125 this->future_map_.unbind (future_rep); 00126 delete future_holder; 00127 return 1; 00128 } 00129 00130 return 0; 00131 } |
|
|
|
Called by the ACE_Future subject in which we are subscribed to when its value is written to. Implements ACE_Future_Observer< T >. Definition at line 84 of file Future_Set.cpp. References ACE_NEW, ACE_Message_Queue< ACE_SYNCH >::enqueue(), ACE_Future_Set< T >::FUTURE, ACE_Future_Set< T >::future_notification_queue_, and ACE_Future< T >::get_rep().
00085 { 00086 ACE_Message_Block *mb; 00087 FUTURE &local_future = const_cast<ACE_Future<T> &> (future); 00088 00089 ACE_NEW (mb, 00090 ACE_Message_Block ((char *) local_future.get_rep (), 0)); 00091 00092 // Enqueue in priority order. 00093 this->future_notification_queue_->enqueue (mb, 0); 00094 } |
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_Future_Observer< T >. Definition at line 99 of file Future_Set.h. |
|
Keeps track of whether we need to delete the message queue.
Definition at line 131 of file Future_Set.h. |
|
Map of , subjects, which have not been written to by client's writer thread. Definition at line 124 of file Future_Set.h. Referenced by ACE_Future_Set< T >::insert(), ACE_Future_Set< T >::next_readable(), and ACE_Future_Set< T >::~ACE_Future_Set(). |
|
Message queue for notifying the reader thread of which have been written to by client's writer thread. Definition at line 128 of file Future_Set.h. Referenced by ACE_Future_Set< T >::ACE_Future_Set(), ACE_Future_Set< T >::next_readable(), ACE_Future_Set< T >::update(), and ACE_Future_Set< T >::~ACE_Future_Set(). |