A collection of delayed submissions of multiple types. More...
#include <delayed_submission.h>
Public Member Functions | |
DelayedSubmissionCollection (bool enableDelayedRequestSubmission=false) | |
Default delayed submission collection constructor. More... | |
DelayedSubmissionCollection (const DelayedSubmissionCollection &)=delete | |
DelayedSubmissionCollection & | operator= (DelayedSubmissionCollection const &)=delete |
DelayedSubmissionCollection (DelayedSubmissionCollection &&o)=delete | |
DelayedSubmissionCollection & | operator= (DelayedSubmissionCollection &&o)=delete |
void | processPre () |
Process pending delayed request submission and generic-pre callback operations. More... | |
void | processPost () |
Process all pending generic-post callback operations. More... | |
void | registerRequest (std::shared_ptr< Request > request, DelayedSubmissionCallbackType callback) |
Register a request for delayed submission. More... | |
ItemIdType | registerGenericPre (DelayedSubmissionCallbackType callback) |
Register a generic callback to execute during processPre() . More... | |
ItemIdType | registerGenericPost (DelayedSubmissionCallbackType callback) |
Register a generic callback to execute during processPost() . More... | |
void | cancelGenericPre (ItemIdType id) |
Cancel a generic callback scheduled for processPre() execution. More... | |
void | cancelGenericPost (ItemIdType id) |
Cancel a generic callback scheduled for processPost() execution. More... | |
bool | isDelayedRequestSubmissionEnabled () const |
Inquire if delayed request submission is enabled. More... | |
A collection of delayed submissions of multiple types.
A collection of delayed submissions of multiple types used by the owner to manage each of the delayed submission types via specialized methods.
|
explicit |
Default delayed submission collection constructor.
Construct an empty collection of delayed submissions. Despite its name, a delayed submission registration may be processed right after registration, thus effectively making it an immediate submission.
[in] | enableDelayedRequestSubmission | whether request submission should be enabled, if false , only generic callbacks are enabled. |
void ucxx::DelayedSubmissionCollection::cancelGenericPost | ( | ItemIdType | id | ) |
Cancel a generic callback scheduled for processPost()
execution.
Cancel the execution of a generic callback that has been previously scheduled for execution during processPos()
. This can be useful if the caller of registerGenericPre()
has given up and will not anymore be able to guarantee the lifetime of the callback.
[in] | id | the ID of the scheduled item, as returned by registerGenericPos() . |
void ucxx::DelayedSubmissionCollection::cancelGenericPre | ( | ItemIdType | id | ) |
Cancel a generic callback scheduled for processPre()
execution.
Cancel the execution of a generic callback that has been previously scheduled for execution during processPre()
. This can be useful if the caller of registerGenericPre()
has given up and will not anymore be able to guarantee the lifetime of the callback.
[in] | id | the ID of the scheduled item, as returned by registerGenericPre() . |
bool ucxx::DelayedSubmissionCollection::isDelayedRequestSubmissionEnabled | ( | ) | const |
Inquire if delayed request submission is enabled.
Check whether delayed submission request is enabled, in which case registerRequest()
may be used to register requests that will be executed during processPre()
.
true
if a delayed request submission is enabled, false
otherwise. void ucxx::DelayedSubmissionCollection::processPost | ( | ) |
Process all pending generic-post callback operations.
Process all pending generic-post callbacks. Generic callbacks are deemed completed when their execution completes.
void ucxx::DelayedSubmissionCollection::processPre | ( | ) |
Process pending delayed request submission and generic-pre callback operations.
Process all pending delayed request submissions and generic callbacks. Generic callbacks are deemed completed when their execution completes. On the other hand, the execution of the delayed request submission callbacks does not imply completion of the operation, only that it has been submitted. The completion of each delayed request submission is handled externally by the implementation of the object being processed, for example by checking the result of ucxx::Request::isCompleted()
.
Generic callbacks may be used to to pass information between threads on the subject that requests have been in fact processed, therefore, requests are processed first, then generic callbacks are.
ItemIdType ucxx::DelayedSubmissionCollection::registerGenericPost | ( | DelayedSubmissionCallbackType | callback | ) |
Register a generic callback to execute during processPost()
.
Register a generic callback that will be executed when processPost()
is called. Lifetime of the callback must be ensured by the caller.
[in] | callback | the callback that will be executed by processPre() . |
ItemIdType ucxx::DelayedSubmissionCollection::registerGenericPre | ( | DelayedSubmissionCallbackType | callback | ) |
Register a generic callback to execute during processPre()
.
Register a generic callback that will be executed when processPre()
is called. Lifetime of the callback must be ensured by the caller.
[in] | callback | the callback that will be executed by processPre() . |
void ucxx::DelayedSubmissionCollection::registerRequest | ( | std::shared_ptr< Request > | request, |
DelayedSubmissionCallbackType | callback | ||
) |
Register a request for delayed submission.
Register a request for delayed submission with a callback that will be executed when the request is in fact submitted when processPre()
is called.
std::runtime_error | if delayed request submission was disabled at construction. |
[in] | request | the request to which the callback belongs, ensuring it remains alive until the callback is invoked. |
[in] | callback | the callback that will be executed by processPre() when the operation is submitted. |