ACE 8.0.5
Loading...
Searching...
No Matches
Future.h File Reference
#include <atomic>
#include "ace/Unbounded_Set.h"
#include "ace/Strategies_T.h"
#include "ace/Synch_Traits.h"
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Condition_Recursive_Thread_Mutex.h"
#include "ace/Future.cpp"

Classes

class  ACE_Future_Holder< T >
 Implementation of object that holds an ACE_Future. More...
class  ACE_Future_Observer< T >
 ACE_Future_Observer<T>. More...
class  ACE_Future_Rep< T >
 ACE_Future_Rep<T>. More...

Typedefs

typedef ACE_Future_Rep< T > FUTURE_REP
 The ACE_Future_Rep Protect operations on the <Future>.

Functions

int cancel ()
bool operator== (const ACE_Future< T > &r) const
bool operator!= (const ACE_Future< T > &r) const
 Inequality operator, which is the opposite of equality.
int set (const T &r)
int get (T &value, ACE_Time_Value *tv=0) const
 operator T ()
int ready () const
 Check if the result is available.
int attach (ACE_Future_Observer< T > *observer)
int detach (ACE_Future_Observer< T > *observer)
void dump () const
 Dump the state of an object.
ACE_Future_Rep< T > * get_rep ()

Variables

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
FUTURE_REPfuture_rep_

Detailed Description

Typedef Documentation

◆ FUTURE_REP

typedef ACE_Future_Rep<T> FUTURE_REP
private

The ACE_Future_Rep Protect operations on the <Future>.

Function Documentation

◆ attach()

int attach ( ACE_Future_Observer< T > * observer)

Attaches the specified observer to a subject (this ACE_Future). The update method of the specified subject will be invoked with a copy of the associated ACE_Future as input when the result gets set. If the result is already set when this method gets invoked, then the update method of the specified subject will be invoked immediately.

Parameters
observerThe observer to attach to the subject.
Return values
0Success.
1The observer was already attached.
-1Error; check ACE_OS::last_error() for an error code.

◆ cancel()

int cancel ( )

◆ detach()

int detach ( ACE_Future_Observer< T > * observer)

Detaches the specified observer from a subject (this ACE_Future). The update method of the specified subject will not be invoked when the ACE_Future_Rep result gets set.

Parameters
observerThe observer to attach to the subject.
Return values
0The observer was successfully detached.
-1Error, including the observer not attached prior to calling this method.

◆ dump()

void dump ( ) const

Dump the state of an object.

◆ get()

int get ( T & value,
ACE_Time_Value * tv = 0 ) const

Wait to get the object's value.

Parameters
valueReceives the value of this ACE_Future when it is set.
tvPointer to an ACE_Time_Value containing the absolute time to wait until for the value to be set. If tv is 0, the call waits indefinitely for the value to be set, unless an error occurs.
Return values
0Success; value contains the value of the ACE_Future.
-1Error; check ACE_OS::last_error() for an error code.

◆ get_rep()

ACE_Future_Rep< T > * get_rep ( )

Get the underlying ACE_Future_Rep pointer. Note that this method should rarely, if ever, be used and that modifying the underlying ACE_Future_Rep should be done with extreme caution.

◆ operator T()

operator T ( )
Deprecated
Note that this method is going away in a subsequent release since it doesn't distinguish between failure results and success results (exceptions should be used, but they aren't portable...). Type conversion, which obtains the result of the asynchronous method invocation. Will block forever. The get() method should be used instead since it separates the error value from the result, and also permits timeouts.

◆ operator!=()

bool operator!= ( const ACE_Future< T > & r) const

Inequality operator, which is the opposite of equality.

◆ operator==()

bool operator== ( const ACE_Future< T > & r) const

Equality operator that returns true if both ACE_Future objects point to the same ACE_Future_Rep object.

Note
It also returns true if both objects have just been instantiated and not used yet.

◆ ready()

int ready ( ) const

Check if the result is available.

◆ set()

int set ( const T & r)

Make the result available. Is used by the server thread to give the result to all waiting clients. Returns 0 for success, -1 on failure. This function only has an effect the first time it is called for the object (actually, the first time the underlying ACE_Future_Rep has a value assigned to it). Subsequent calls return 0 (success) but have no effect.

Variable Documentation

◆ ACE_ALLOC_HOOK_DECLARE

ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

◆ future_rep_

FUTURE_REP* future_rep_
private