A thread to progress a ucxx::Worker
.
More...
#include <worker_progress_thread.h>
Public Member Functions | |
WorkerProgressThread (const WorkerProgressThread &)=delete | |
WorkerProgressThread & | operator= (WorkerProgressThread const &)=delete |
WorkerProgressThread (WorkerProgressThread &&o)=default | |
WorkerProgressThread & | operator= (WorkerProgressThread &&o)=default |
WorkerProgressThread (const bool pollingMode, std::function< bool(void)> progressFunction, std::function< void(void)> signalWorkerFunction, std::function< void(void)> setThreadId, ProgressThreadStartCallback startCallback, ProgressThreadStartCallbackArg startCallbackArg, std::shared_ptr< DelayedSubmissionCollection > delayedSubmissionCollection) | |
Constructor of shared_ptr<ucxx::Worker> . More... | |
~WorkerProgressThread () | |
ucxx::WorkerProgressThread destructor. More... | |
bool | pollingMode () const |
Returns whether the thread was created for polling progress mode. More... | |
std::thread::id | getId () const |
Returns the ID of the progress thread. More... | |
bool | isRunning () const |
Returns whether the thread is running. More... | |
void | stop () |
A thread to progress a ucxx::Worker
.
A thread to progress the ucxx::Worker
, thus moving all such blocking operations out of the main program thread. It may also be used to execute submissions, such as from ucxx::Request
objects, therefore also moving any blocking costs of those to this thread, as well as generic pre-progress and post-progress callbacks that can be used by the program to block until that stage is reached.
ucxx::WorkerProgressThread::WorkerProgressThread | ( | const bool | pollingMode, |
std::function< bool(void)> | progressFunction, | ||
std::function< void(void)> | signalWorkerFunction, | ||
std::function< void(void)> | setThreadId, | ||
ProgressThreadStartCallback | startCallback, | ||
ProgressThreadStartCallbackArg | startCallbackArg, | ||
std::shared_ptr< DelayedSubmissionCollection > | delayedSubmissionCollection | ||
) |
Constructor of shared_ptr<ucxx::Worker>
.
The constructor for a shared_ptr<ucxx::Worker>
object. The default constructor is made private to ensure all UCXX objects are shared pointers for correct lifetime management.
This thread runs asynchronously with the main application thread. If you require cross-thread synchronization (for example when tearing down the thread or canceling requests), use the generic pre and post callbacks with a CallbackNotifier
that synchronizes with the application thread. Since the worker progress itself may change state, it is usually the case that synchronization is needed in both pre and post callbacks.
[in] | pollingMode | whether the thread should use polling mode to progress. |
[in] | progressFunction | user-defined progress function implementation. |
[in] | setThreadId | callback function executed before the startCallback with a purpose of setting the thread ID with the parent so it is known before the progress loop starts. |
[in] | signalWorkerFunction | user-defined function to wake the worker progress event (when pollingMode is false ). |
[in] | startCallback | user-defined callback function to be executed at the start of the progress thread. |
[in] | startCallbackArg | an argument to be passed to the start callback. |
[in] | delayedSubmissionCollection | collection of delayed submissions to be processed during progress. |
ucxx::WorkerProgressThread::~WorkerProgressThread | ( | ) |
ucxx::WorkerProgressThread
destructor.
Raises the stop signal and joins the thread.
std::thread::id ucxx::WorkerProgressThread::getId | ( | ) | const |
Returns the ID of the progress thread.
bool ucxx::WorkerProgressThread::isRunning | ( | ) | const |
Returns whether the thread is running.
bool ucxx::WorkerProgressThread::pollingMode | ( | ) | const |
Returns whether the thread was created for polling progress mode.