You.i Engine
CYIFuture<> Class Template Reference

Detailed Description

template<>
class CYIFuture<>

Void specialization of CYIFuture. This class doesn't hold a value, but instead simply holds a 'completed' state.

See also
CYIFuture<ResultType>

#include <thread/YiFuture.h>

Inheritance diagram for CYIFuture<>:

Public Member Functions

 CYIFuture ()
 
virtual ~CYIFuture ()
 
bool Set ()
 
- Public Member Functions inherited from CYIAbstractFuture
virtual ~CYIAbstractFuture ()
 
bool IsCancelled () const
 
bool IsCompleted () const
 
bool Cancel ()
 
bool CancelOrWait ()
 
bool Wait () const
 
bool Wait (uint64_t uTimeoutMs) const
 

Public Attributes

CYISignal Completed
 A signal triggered when this object is marked as completed. More...
 
- Public Attributes inherited from CYIAbstractFuture
CYISignal ExecutionStarted
 A signal triggered when an associated task begins execution. More...
 
CYISignal Cancelled
 A signal triggered when this object is cancelled. More...
 

Protected Member Functions

bool SetCompleted ()
 Equivalent to CYIFuture<>::Set(), but requires that the m_mutex be locked prior to calling this function. More...
 
- Protected Member Functions inherited from CYIAbstractFuture
void ExclusiveLock () const
 Locks both this object and the associated task (if it exists). More...
 
void ExclusiveUnlock () const
 Unlocks both this object and the associated task (if it exists). More...
 
void NotifyStateChanged () const
 Notify waiters (e.g. threads blocked on calls to Wait, Get or Take) of state change. More...
 
bool SetTask (CYITaskBase *pTask)
 Sets the task asssociated with this object to the provided task. Returns true if the task was associated successfully, false otherwise. Has no effect if a task has already been assigned, or if this future has been cancelled or had a value assigned already. More...
 
void DisconnectFromTask ()
 Removes the task reference, if it exists. If an associated task exists, an attempt is made at cancelling it. More...
 
bool SetCancelledNonLocking ()
 Sets the 'cancelled' flag on this object, if it hasn't been done already and the future hasn't had a value assigned to it. Will awaken all waiters if the cancellation was successful (and will trigger the Cancelled signal). Returns false if the future could not be cancelled. The caller must have m_mutex locked. More...
 
bool WaitNonLocking () const
 Equivalent to the Wait() function, but the caller must have m_mutex locked. More...
 
bool WaitNonLocking (uint64_t uTimeoutMs) const
 Equivalent to the Wait() function, but the caller must have m_mutex locked. More...
 
bool CancelInternal (bool bWait)
 

Friends

template<typename T >
class CYITask
 

Constructor & Destructor Documentation

virtual CYIFuture<>::~CYIFuture ( )
virtual

Member Function Documentation

bool CYIFuture<>::Set ( )

Marks this future as completed.

The future can only be set as completed once, and cannot be done if the future has been cancelled. A successful marking will result in the Completed signal being triggered as well as threads blocked on calls to Wait to wake up.

Returns
Returns true if the assignement succeeded.
bool CYIFuture<>::SetCompleted ( )
protected

Equivalent to CYIFuture<>::Set(), but requires that the m_mutex be locked prior to calling this function.

Friends And Related Function Documentation

template<typename T >
friend class CYITask
friend

Member Data Documentation

CYISignal CYIFuture<>::Completed

A signal triggered when this object is marked as completed.


The documentation for this class was generated from the following file: