Specialized Python implementation of a ucxx::Future
.
More...
#include <python_future.h>
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
.
◆ ~Future()
virtual ucxx::python::Future::~Future |
( |
| ) |
|
|
virtual |
Virtual destructor.
Virtual destructor with empty implementation.
Reimplemented from ucxx::Future.
◆ 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_error | if 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_error | if the object is invalid or has been already released. |
- Parameters
-
[in] | status | request 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_error | if 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_error | if the object is invalid or has been already released. |
- Parameters
-
[in] | status | request completion status. |
Implements ucxx::Future.
◆ createFuture
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] | notifier | notifier 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] | asyncioEventLoop | pointer to a valid Python object containing the event loop that the application is using, to which the future will belong to. |
[in] | notifier | notifier 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: