All Classes Namespaces Functions Variables Typedefs Enumerations Friends
Public Member Functions | Friends | List of all members
ucxx::python::Future Class Reference

Specialized Python implementation of a ucxx::Future. More...

#include <python_future.h>

Inheritance diagram for ucxx::python::Future:
ucxx::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...
 
void notify (ucs_status_t status)
 Inform the notifier thread that the future has completed. More...
 
void set (ucs_status_t status)
 Set the future completion status. More...
 
void * getHandle ()
 Get the underlying PyObject* handle but does not release ownership. More...
 
void * release ()
 Get the underlying PyObject* handle and release ownership. More...
 
- Public Member Functions inherited from ucxx::Future
 Future (const Future &)=delete
 
Futureoperator= (Future const &)=delete
 
 Future (Future &&o)=delete
 
Futureoperator= (Future &&o)=delete
 

Friends

std::shared_ptr<::ucxx::FuturecreateFuture (std::shared_ptr<::ucxx::Notifier > notifier)
 Constructor of shared_ptr<ucxx::python::Future>. More...
 
std::shared_ptr<::ucxx::FuturecreateFutureWithEventLoop (PyObject *asyncioEventLoop, std::shared_ptr<::ucxx::Notifier > notifier)
 Constructor of shared_ptr<ucxx::python::Future>. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ucxx::Future
 Future (std::shared_ptr< Notifier > notifier)
 Construct a future that may be notified from a notifier object. More...
 
- Protected Attributes inherited from ucxx::Future
std::shared_ptr< Notifier_notifier {nullptr}
 The notifier object.
 

Detailed Description

Specialized Python implementation of a ucxx::Future.

Specialized Python implementation of a ucxx::Future, where the future being handled is an instance of asyncio.Future.

Constructor & Destructor Documentation

◆ ~Future()

virtual ucxx::python::Future::~Future ( )
virtual

Virtual destructor.

Virtual destructor with empty implementation.

Reimplemented from ucxx::Future.

Member Function Documentation

◆ getHandle()

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

Get the underlying PyObject* handle but does not release ownership.

Get the underlying PyObject* 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 Python 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 PyObject* handle.

Implements ucxx::Future.

◆ notify()

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

Inform the notifier thread that the future has completed.

Inform the notifier thread that the future has completed so it can notify the event loop of that occurrence.

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

Implements ucxx::Future.

◆ release()

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

Get the underlying PyObject* handle and release ownership.

Get the underlying PyObject* handle releasing ownership. This should be used when the future needs to be permanently transferred to Python 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 PyObject* handle.

Implements ucxx::Future.

◆ set()

void ucxx::python::Future::set ( ucs_status_t  status)
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.

Implements ucxx::Future.

Friends And Related Function Documentation

◆ createFuture

std::shared_ptr<::ucxx::Future> createFuture ( std::shared_ptr<::ucxx::Notifier notifier)
friend

Constructor of shared_ptr<ucxx::python::Future>.

The constructor for a shared_ptr<ucxx::python::Future> object. The default constructor is made private to ensure all UCXX objects are shared pointers and correct lifetime management.

Parameters
[in]notifiernotifier object running on a separate thread.
Returns
The shared_ptr<ucxx::python::Worker> object

◆ createFutureWithEventLoop

std::shared_ptr<::ucxx::Future> createFutureWithEventLoop ( PyObject *  asyncioEventLoop,
std::shared_ptr<::ucxx::Notifier notifier 
)
friend

Constructor of shared_ptr<ucxx::python::Future>.

The constructor for a shared_ptr<ucxx::python::Future> object. The default constructor is made private to ensure all UCXX objects are shared pointers and correct lifetime management.

Parameters
[in]asyncioEventLooppointer to a valid Python object containing the event loop that the application is using, to which the future will belong to.
[in]notifiernotifier object running on a separate thread.
Returns
The shared_ptr<ucxx::python::Worker> object

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