Notifier for status of futures. More...
#include <notifier.h>
Public Member Functions | |
Notifier (const Notifier &)=delete | |
Notifier & | operator= (Notifier const &)=delete |
Notifier (Notifier &&o)=delete | |
Notifier & | operator= (Notifier &&o)=delete |
virtual | ~Notifier () |
Virtual destructor. More... | |
virtual void | scheduleFutureNotify (std::shared_ptr< Future > future, ucs_status_t status)=0 |
Schedule notification of completed future. More... | |
virtual RequestNotifierWaitState | waitRequestNotifier (uint64_t period)=0 |
Wait for a new event with a timeout in nanoseconds. More... | |
virtual void | runRequestNotifier ()=0 |
Notify event loop of all pending completed futures. More... | |
virtual void | stopRequestNotifierThread ()=0 |
Make known to the notifier thread that it should stop. More... | |
virtual bool | isRunning () const =0 |
Returns whether the thread is running. More... | |
Notifier for status of futures.
A notifier used to delay notification of futures to a more appropriate stage of the program execution, such as when it will be less resource intensive or free of risks of effects such as deadlocks, for example when notifying Python futures where the GIL is required.
|
inlinevirtual |
Virtual destructor.
Virtual destructor with empty implementation.
Reimplemented in ucxx::python::Notifier.
|
pure virtual |
Returns whether the thread is running.
Implemented in ucxx::python::Notifier.
|
pure virtual |
Notify event loop of all pending completed futures.
This method will notify the internal resource of all pending completed futures. Notifying the resource may require some exclusion mechanism, thus it should not run indefinitely, but instead run periodically. Futures that completed must first be scheduled with scheduleFutureNotify()
.
Implemented in ucxx::python::Notifier.
|
pure virtual |
Schedule notification of completed future.
Schedule the notification of a completed Python future, but does not set the future's result yet, which is later done by runRequestNotifier()
. Because this call does not notify the future, it does not require any resources associated with it.
This is meant to be called from ucxx::Future::notify()
.
[in] | future | future to notify. |
[in] | status | the request completion status. |
|
pure virtual |
Make known to the notifier thread that it should stop.
Often called when the application is shutting down, make known to the notifier that it should stop and exit.
Implemented in ucxx::python::Notifier.
|
pure virtual |
Wait for a new event with a timeout in nanoseconds.
Block while waiting for an event (new future to be notified or stop signal) with added timeout in nanoseconds to unblock after a that period if no event has occurred. A period of zero means this call will never unblock until an event occurs.
WARNING: Be cautious using a period of zero, if no event ever occurs it will be impossible to continue the thread.
[in] | period | the time in nanoseconds to wait for an event before unblocking. |
Implemented in ucxx::python::Notifier.