Signals running diagnostic routines the premature cancellation of a conversation to conserve resources.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 654e2e9e4acaProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Signals running diagnostic routines the premature cancellation of a conversation to conserve resources.
The class ara::diag::CancellationHandler informs diagnostic applications about the premature cancellation of an ongoing processing in Diagnostic Management [SWS_DM_00608]. The object created by the DM core allows the service processor to query the cancellation status via IsCanceled() or to be notified via callback using SetNotifier() in order to immediately cease service processing [SWS_DM_00615]. Once set, a cancellation status is irrevocable, and accesses to the instance must be secured on the application side because the interface is not thread-safe.
Context
Within module diag, the class ara::diag::CancellationHandler acts as a shared state indicator that indicates whether ongoing diagnostic processing is to be canceled prematurely [SWS_DM_00608]. In the AUTOSAR Adaptive Platform, the class mediates between the server instance of Diagnostic Management (DM) and the executing application logic, such as during the processing of manufacturer-specific UDS services (AUTOSAR_AP_SWS_Diagnostics §7.3.2.8.24 “Custom Diagnostic Services”, [SWS_DM_00502]).
If an active diagnostic conversation is canceled by external events or protocol requirements, the diagnostic server instance is obligated to cease the started activity as quickly as possible [SWS_DM_00278]. This cancellation is signaled to the service processor via the CancellationHandler, so that resource-intensive computations are aborted and the inadmissible sending of diagnostic responses prior to the start of their transmission is prevented [SWS_DM_00279].
Lifecycle
Instantiation of ara::diag::CancellationHandler is subject to the exclusive control of the diagnostic framework: The default constructor is explicitly deleted for applications (delete), so instances can be created exclusively by the DM core [SWS_DM_00609]. To ensure unique state assignment, the class is specified as a non-copyable single instance; copy constructor [SWS_DM_00611] and copy assignment operator [SWS_DM_00613] are deleted.
In contrast, the class supports move semantics: The move constructor [SWS_DM_00610] and the move assignment operator [SWS_DM_00612] are declared as default implementations as noexcept. This presumably allows the framework to efficiently transfer ownership of the instance into downstream execution contexts. Question (open)
In terms of state, the instance exhibits monotonic behavior. Immediately after initialization, IsCanceled() signals the value false[SWS_DM_00984]. As soon as the associated diagnostic conversation is canceled, the state changes to true. This cancellation status persists irreversibly until the destruction of the instance [SWS_DM_00984].
Registration or polling: By means of SetNotifier(), the application registers a notification function of type ara::diag::CancellationHandler::CancellationHandlerSetNotifier ([SWS_DM_02075]), which is called when a cancellation occurs [SWS_DM_00615]. Alternatively or concurrently, it queries IsCanceled() cyclically [SWS_DM_00614].
Signaling: If the DM cancels the conversation, the status in the handler changes to true[SWS_DM_00984] and the registered notifier is triggered [SWS_DM_00615].
Cancellation: The application immediately ceases the started work [SWS_DM_00278]. If the response has not yet been transmitted, the DM suppresses transmission [SWS_DM_00279].
Completion: After completion of processing, the handler object is destroyed together with the service context.
The interface of ara::diag::CancellationHandler features an error-free design. All methods such as IsCanceled()[SWS_DM_00614], SetNotifier()[SWS_DM_00615], as well as the move operations [SWS_DM_00610][SWS_DM_00612] are exception-safe (noexcept) and return no error codes.
Calling SetNotifier() multiple times does not lead to an error: Subsequent registrations completely overwrite the previously set callback [SWS_DM_00615], [SWS_DM_01348].
Thread safety requires special attention: All member functions (IsCanceled, SetNotifier) and the callback type are explicitly declared as not thread-safe [SWS_DM_00614], [SWS_DM_00615], [SWS_DM_02075]. If status queries or notifier registrations are performed across thread boundaries, the application must deploy external protection mechanisms. Furthermore, the callback is likely to be called synchronously in the triggering thread of the DM, which is why application-side notifier functions should remain non-blocking. Question Q-26c43c035d4f18a3 (open)
This guide was generated by an AI system based on the AUTOSAR Adaptive R25-11 specification.
Registering a notifier function which is called if the diagnostic service execution is cancelled in DM. A consecutive call of this method will overwrite the previous registered notifier.
Registering a notifier function which is called if the diagnostic service execution is cancelled in DM. A consecutive call of this method will overwrite the previous registered notifier.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: d99693aaeb20ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The ara::diag::CancellationHandler::SetNotifier method ([SWS_DM_00615]) from the header ara/diag/cancellation_handler.h registers a callback function of type CancellationHandlerSetNotifier. This function is called by Diagnostic Management (DM) as soon as the execution of a diagnostic service is cancelled. The registration itself is performed synchronously and has no return value (void).
Error Handling and Execution Semantics
The call is specified as noexcept and is considered exception-safe (exception safe) ([SWS_DM_00615]). Specific error codes, error returns, or DET/DEM notifications are not provided for this interface.
Concurrency and Limitations
Regarding thread safety, the method is classified as not thread-safe ([SWS_DM_00615]). Therefore, an instance of CancellationHandler must not be modified concurrently without protection. In the event of multiple consecutive calls to SetNotifier on the same instance, the DM overwrites the previously registered notifier ([SWS_DM_01348], SWS Diagnostics p. 193). In addition, the callback function should expediently not perform any blocking operations in order not to delay the internal cancellation handling of the DM. Question Q-94d2cb76c17c4fa4 (open)
Interaction
A CancellationHandler instance is passed to service and routine handlers by the DM as a parameter, for example during generic service processing ([SWS_DM_00618]), data accesses ([SWS_DM_00636]), or routines ([SWS_DM_00554]). If a diagnostic conversation aborts, the DM aborts running internal activities where possible ([SWS_DM_00278]) and discards transmission of the response ([SWS_DM_00279]). Registration via SetNotifier offers an event-driven reaction path in addition to synchronous querying of the cancellation status via IsCanceled ([SWS_DM_00984]).
This text was created by an AI; all technical statements are substantiated by the payload.
gemini-3.8-flash-low· 2026-10-13 · German original