A thread to progress a ucxx::Worker.
More...
#include <worker_progress_thread.h>
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.
◆ WorkerProgressThread() [1/2]
| ucxx::WorkerProgressThread::WorkerProgressThread |
( |
WorkerProgressThread && | o | ) |
|
|
default |
Move constructor of WorkerProgressThread.
Transfers ownership of the progress thread resources from the source object to the newly constructed object. The source object is left in a valid but unspecified state.
- Parameters
-
| [in] | o | the source object to move from. |
◆ WorkerProgressThread() [2/2]
Constructor of WorkerProgressThread.
The constructor for a WorkerProgressThread 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.
auto worker = context->workerBuilder().build();
- Parameters
-
| [in] | pollingMode | whether the thread should use polling mode to progress. |
| [in] | progressFunction | user-defined progress function implementation. |
| [in] | signalWorkerFunction | user-defined function to wake the worker progress event (when pollingMode is false). |
| [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] | 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. |
◆ ~WorkerProgressThread()
| ucxx::WorkerProgressThread::~WorkerProgressThread |
( |
| ) |
|
◆ getId()
| std::thread::id ucxx::WorkerProgressThread::getId |
( |
| ) |
const |
|
nodiscard |
Returns the ID of the progress thread.
- Returns
- the progress thread ID.
◆ isRunning()
| bool ucxx::WorkerProgressThread::isRunning |
( |
| ) |
const |
|
nodiscard |
Returns whether the thread is running.
- Returns
- Whether the thread is running.
◆ operator=()
| WorkerProgressThread & ucxx::WorkerProgressThread::operator= |
( |
WorkerProgressThread && | o | ) |
|
|
default |
Move assignment operator of WorkerProgressThread.
Transfers ownership of the progress thread resources from the source object to the target object. The source object is left in a valid but unspecified state.
- Parameters
-
| [in] | o | the source object to move from. |
- Returns
- reference to the target object.
◆ pollingMode()
| bool ucxx::WorkerProgressThread::pollingMode |
( |
| ) |
const |
|
nodiscard |
Returns whether the thread was created for polling progress mode.
- Returns
- Whether polling mode is enabled.
◆ stop()
Stop the progress thread.
Raises the stop signal and joins the thread.
- Parameters
-
| [in] | stopConfig | progress thread stop synchronization configuration. |
The documentation for this class was generated from the following file: