Functions for handling the cancellation of concurrent operations.
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.
- Create the CVCANCELLATIONTOKENSOURCE and the CVCANCELLATIONTOKEN handles via CVCCreateCancellationToken. This will connect the source and the token for future cancellations.
- Create the abortable operations
- Trigger the cancellation via CVCCancellationTokenSourceCancel
- CVCCancellationTokenIsCanceled gives a clue about whether the token is already canceled or not.
◆ CVCANCELLATIONTOKEN
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.
- See also
- CVCCreateCancellationToken
◆ CVCANCELLATIONTOKENSOURCE
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.
◆ CVCCancellationTokenIsCanceled()
Gets the cancellation state of the token.
- Since
- 1.0.0
- Parameters
-
[in] | Token | The token object. |
[out] | State | State of the cancellation, true if canceled, false otherwise
|
◆ CVCCancellationTokenSourceCancel()
Triggers a cancellation.
This call cancels all operations that run with the corresponding CVCANCELLATIONTOKEN handle.
- Since
- 1.0.0
- Parameters
-
[in] | TokenSource | The token source object.
|
◆ CVCCreateCancellationToken()
◆ CVCIsCancellationToken()
Checks if the specified handle is a cancellation token.
- Since
- 1.0.0
- Parameters
-
[in] | Token | A handle to be examined. |
- Returns
- true if Handle is a cancellation token; false if not.
- See also
- CVCCreateCancellationToken
◆ CVCIsCancellationTokenSource()
Checks if the specified handle is a cancellation token source.
- Since
- 1.0.0
- Parameters
-
[in] | TokenSource | A handle to be examined. |
- Returns
- true if Handle is a cancellation token source; false if not.
- See also
- CVCCreateCancellationToken