All Classes Namespaces Functions Variables Typedefs Enumerations Friends
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ucxx::Future Class Referenceabstract

Represent a future that may be notified by a specialized notifier. More...

#include <future.h>

Inheritance diagram for ucxx::Future:
ucxx::python::Future

Public Member Functions

 Future (const Future &)=delete
 
Futureoperator= (Future const &)=delete
 
 Future (Future &&o)=delete
 
Futureoperator= (Future &&o)=delete
 
virtual ~Future ()
 Virtual destructor. More...
 
virtual void notify (ucs_status_t status)=0
 Inform the notifier that the future has completed. More...
 
virtual void set (ucs_status_t status)=0
 Set the future completion status. More...
 
virtual void * getHandle ()=0
 Get the underlying handle but does not release ownership. More...
 
virtual void * release ()=0
 Get the underlying handle and release ownership. More...
 

Protected Member Functions

 Future (std::shared_ptr< Notifier > notifier)
 Construct a future that may be notified from a notifier object. More...
 

Protected Attributes

std::shared_ptr< Notifier_notifier {nullptr}
 The notifier object.
 

Detailed Description

Represent a future that may be notified by a specialized notifier.

Represent a future object that may postpone notification of its status to a more appropriate stage by a specialize notifier, such as ucxx::Notifier.

Constructor & Destructor Documentation

◆ Future()

ucxx::Future::Future ( std::shared_ptr< Notifier notifier)
inlineexplicitprotected

Construct a future that may be notified from a notifier object.

Construct a future that may be notified from a notifier object, usually running on a separate thread to decrease overhead from the application thread.

This class may also be used to set the result or exception from any thread.

Parameters
[in]notifiernotifier object, possibly running on a separate thread.

◆ ~Future()

virtual ucxx::Future::~Future ( )
inlinevirtual

Virtual destructor.

Virtual destructor with empty implementation.

Reimplemented in ucxx::python::Future.

Member Function Documentation

◆ getHandle()

virtual void* ucxx::Future::getHandle ( )
pure virtual

Get the underlying handle but does not release ownership.

Get the underlying handle without releasing ownership. This can be useful for example for logging, where we want to see the address of the pointer but do not want to transfer ownership.

Warning
The destructor will also destroy the future, a pointer taken via this method will cause the object to become invalid.
Exceptions
std::runtime_errorif the object is invalid or has been already released.
Returns
The underlying handle.

Implemented in ucxx::python::Future.

◆ notify()

virtual void ucxx::Future::notify ( ucs_status_t  status)
pure virtual

Inform the notifier that the future has completed.

Inform the notifier that the future has completed so it can notify associated resources of that occurrence.

Exceptions
std::runtime_errorif the object is invalid or has been already released.
Parameters
[in]statusrequest completion status.

Implemented in ucxx::python::Future.

◆ release()

virtual void* ucxx::Future::release ( )
pure virtual

Get the underlying handle and release ownership.

Get the underlying handle releasing ownership. This should be used when the future needs to be permanently transferred to consumer code. After calling this method the object becomes invalid for any other uses.

Exceptions
std::runtime_errorif the object is invalid or has been already released.
Returns
The underlying handle.

Implemented in ucxx::python::Future.

◆ set()

virtual void ucxx::Future::set ( ucs_status_t  status)
pure virtual

Set the future completion status.

Set the future status as completed, either with a successful completion or error.

Exceptions
std::runtime_errorif the object is invalid or has been already released.
Parameters
[in]statusrequest completion status.

Implemented in ucxx::python::Future.


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