Loading...
Searching...
No Matches
future.h
1
5#pragma once
6
7#include <memory>
8
9#include <ucp/api/ucp.h>
10
11#include <ucxx/notifier.h>
12
13namespace ucxx {
14
21class Future : public std::enable_shared_from_this<Future> {
22 protected:
23 std::shared_ptr<Notifier> _notifier{nullptr};
24
35 explicit Future(std::shared_ptr<Notifier> notifier) : _notifier(notifier) {}
36
37 public:
38 Future() = delete;
39 Future(const Future&) = delete;
40 Future& operator=(Future const&) = delete;
41 Future(Future&& o) = delete;
42 Future& operator=(Future&& o) = delete;
43
49 virtual ~Future() {}
50
61 virtual void notify(ucs_status_t status) = 0;
62
72 virtual void set(ucs_status_t status) = 0;
73
88 [[nodiscard]] virtual void* getHandle() = 0;
89
101 [[nodiscard]] virtual void* release() = 0;
102};
103
104} // namespace ucxx
Represent a future that may be notified by a specialized notifier.
Definition future.h:21
virtual void * getHandle()=0
Get the underlying handle but does not release ownership.
virtual void notify(ucs_status_t status)=0
Inform the notifier that the future has completed.
virtual void * release()=0
Get the underlying handle and release ownership.
Future(std::shared_ptr< Notifier > notifier)
Construct a future that may be notified from a notifier object.
Definition future.h:35
virtual ~Future()
Virtual destructor.
Definition future.h:49
virtual void set(ucs_status_t status)=0
Set the future completion status.
std::shared_ptr< Notifier > _notifier
The notifier object.
Definition future.h:23
Definition address.h:16