All Classes Namespaces Functions Variables Typedefs Enumerations Friends
Public Member Functions | List of all members
ucxx::Notifier Class Referenceabstract

Notifier for status of futures. More...

#include <notifier.h>

Inheritance diagram for ucxx::Notifier:
ucxx::python::Notifier

Public Member Functions

 Notifier (const Notifier &)=delete
 
Notifieroperator= (Notifier const &)=delete
 
 Notifier (Notifier &&o)=delete
 
Notifieroperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~Notifier()

virtual ucxx::Notifier::~Notifier ( )
inlinevirtual

Virtual destructor.

Virtual destructor with empty implementation.

Reimplemented in ucxx::python::Notifier.

Member Function Documentation

◆ isRunning()

virtual bool ucxx::Notifier::isRunning ( ) const
pure virtual

Returns whether the thread is running.

Returns
Whether the thread is running.

Implemented in ucxx::python::Notifier.

◆ runRequestNotifier()

virtual void ucxx::Notifier::runRequestNotifier ( )
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.

◆ scheduleFutureNotify()

virtual void ucxx::Notifier::scheduleFutureNotify ( std::shared_ptr< Future future,
ucs_status_t  status 
)
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().

Parameters
[in]futurefuture to notify.
[in]statusthe request completion status.

◆ stopRequestNotifierThread()

virtual void ucxx::Notifier::stopRequestNotifierThread ( )
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.

◆ waitRequestNotifier()

virtual RequestNotifierWaitState ucxx::Notifier::waitRequestNotifier ( uint64_t  period)
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.

Parameters
[in]periodthe time in nanoseconds to wait for an event before unblocking.

Implemented in ucxx::python::Notifier.


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