All Classes Namespaces Functions Variables Typedefs Enumerations Friends
notifier.h
1 
5 #pragma once
6 
7 #include <chrono>
8 #include <memory>
9 
10 #include <ucp/api/ucp.h>
11 
12 namespace ucxx {
13 
19 enum class RequestNotifierThreadState { NotRunning = 0, Running, Stopping };
20 
26 enum class RequestNotifierWaitState { Ready = 0, Timeout, Shutdown };
27 
28 class Future;
29 
38 class Notifier {
39  protected:
40  Notifier() = default;
41 
42  public:
43  Notifier(const Notifier&) = delete;
44  Notifier& operator=(Notifier const&) = delete;
45  Notifier(Notifier&& o) = delete;
46  Notifier& operator=(Notifier&& o) = delete;
47 
53  virtual ~Notifier() {}
54 
67  virtual void scheduleFutureNotify(std::shared_ptr<Future> future, ucs_status_t status) = 0;
68 
81  virtual RequestNotifierWaitState waitRequestNotifier(uint64_t period) = 0;
82 
91  virtual void runRequestNotifier() = 0;
92 
99  virtual void stopRequestNotifierThread() = 0;
100 
106  [[nodiscard]] virtual bool isRunning() const = 0;
107 };
108 
109 } // namespace ucxx
Notifier for status of futures.
Definition: notifier.h:38
virtual void stopRequestNotifierThread()=0
Make known to the notifier thread that it should stop.
virtual void runRequestNotifier()=0
Notify event loop of all pending completed futures.
virtual void scheduleFutureNotify(std::shared_ptr< Future > future, ucs_status_t status)=0
Schedule notification of completed future.
virtual bool isRunning() const =0
Returns whether the thread is running.
virtual RequestNotifierWaitState waitRequestNotifier(uint64_t period)=0
Wait for a new event with a timeout in nanoseconds.
virtual ~Notifier()
Virtual destructor.
Definition: notifier.h:53
Definition: address.h:15
RequestNotifierWaitState
The state with which a wait operation completed.
Definition: notifier.h:26
RequestNotifierThreadState
The state of the notifier thread.
Definition: notifier.h:19