Functions for handling the cancellation of concurrent operations. More...
Typedefs | |
typedef void * | CVCANCELLATIONTOKEN |
Object to pass to abortable operations. More... | |
typedef void * | CVCANCELLATIONTOKENSOURCE |
Handle to send the abort signal to token registered operations. More... | |
Functions | |
cvbres_t | CVCCancellationTokenIsCanceled (CVCANCELLATIONTOKEN Token, cvbbool_t &State) |
Gets the cancellation state of the token. More... | |
cvbres_t | CVCCancellationTokenSourceCancel (CVCANCELLATIONTOKENSOURCE TokenSource) |
Triggers a cancellation. More... | |
cvbres_t | CVCCreateCancellationToken (CVCANCELLATIONTOKENSOURCE &TokenSource, CVCANCELLATIONTOKEN &Token) |
Creates cancellation token and source. More... | |
cvbbool_t | CVCIsCancellationToken (CVCANCELLATIONTOKEN Token) |
Checks if the specified handle is a cancellation token. More... | |
cvbbool_t | CVCIsCancellationTokenSource (CVCANCELLATIONTOKENSOURCE TokenSource) |
Checks if the specified handle is a cancellation token source. More... | |
Functions for handling the cancellation of concurrent operations.
The concept of cancellation tokens improves the way the execution of parallel or concurring operations are managed. This way, the programmer has the full control of cancelling tasks from a single CVCANCELLATIONTOKENSOURCE.
Object to pass to abortable operations.
The token will assicuate a cancel operation from the source to the ongoing operation and abort this operation. A token can be reused in multiple operations at the same time, but can only be used once for cancelling an operation or a set of operations. The handle is created and connected to a source via CVCCreateCancellationToken.
Handle to send the abort signal to token registered operations.
This object is responsible for informing all tasks holding the connected token to cancel their execution. For this a function called CVCCancellationTokenSourceCancel sends a notification to all tokens.
cvbres_t CVCCancellationTokenIsCanceled | ( | CVCANCELLATIONTOKEN | Token, |
cvbbool_t & | State | ||
) |
Gets the cancellation state of the token.
[in] | Token | The token object. |
[out] | State | State of the cancellation, true if canceled, false otherwise
|
cvbres_t CVCCancellationTokenSourceCancel | ( | CVCANCELLATIONTOKENSOURCE | TokenSource | ) |
Triggers a cancellation.
This call cancels all operations that run with the corresponding CVCANCELLATIONTOKEN handle.
[in] | TokenSource | The token source object.
|
cvbres_t CVCCreateCancellationToken | ( | CVCANCELLATIONTOKENSOURCE & | TokenSource, |
CVCANCELLATIONTOKEN & | Token | ||
) |
Creates cancellation token and source.
[out] | TokenSource | The token source handle. |
[out] | Token | The token handle. |
cvbbool_t CVCIsCancellationToken | ( | CVCANCELLATIONTOKEN | Token | ) |
Checks if the specified handle is a cancellation token.
[in] | Token | A handle to be examined. |
cvbbool_t CVCIsCancellationTokenSource | ( | CVCANCELLATIONTOKENSOURCE | TokenSource | ) |
Checks if the specified handle is a cancellation token source.
[in] | TokenSource | A handle to be examined. |