Provides an interface for a executing context, which asynchronously invokes Callable ([4] [func.wrap.func]) objects in a guaranteed thread-safe context. The execute(...) method in [SWS_CORE_00024] returns a ara::core::Future object to the caller for further result/error extraction or management of the asynchronous-context; the execute_oneway(...) method in [SWS_CORE_00025] imply fire-and-forget semantics and thus no asynchronous-context (ara::core::Future) is returned.
Literaturverzeichnis SWS Core: [4] ISO/IEC 14882:2014, Information technology – Programming languages – C++ – www.iso.org
Enables the asynchronous, thread-safe execution of callables with optional return values via futures.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 690890643de1ProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Enables the asynchronous, thread-safe execution of callables with optional return values via futures.
Class ara::core::Executor provides an interface for asynchronous execution of callables in a guaranteed thread-safe context. Tasks are either initiated in a result-oriented manner via execute[SWS_CORE_00024] returning a ara::core::Future for values or error codes, or dispatched status-independently via oneway_execute[SWS_CORE_00025] in fire-and-forget mode. As a central constraint, it must be noted that execute itself is not thread-safe and parallel calls on the same instance must be synchronized externally, whereas execution of the callable in the background is performed thread-safely.
Context
Class ara::core::Executor provides an interface for an execution context that asynchronously executes callables in a guaranteed thread-safe environment. It serves as an abstraction layer between the calling thread and asynchronous background processing. Two mechanisms are available for submitting tasks: Method execute[SWS_CORE_00024] passes a task in a result-oriented manner and returns a ara::core::Future object, through which the subsequent return value or an error code can be synchronized and queried. For pure notifications or status-independent background operations, the class provides method oneway_execute[SWS_CORE_00025], which follows fire-and-forget semantics and does not return an asynchronous context to the caller. Presumably, the concrete implementation encapsulates a thread management or task queue in the background to coordinate concurrent processing. Question Q-068fe33f2900d6cf (open)
Lifecycle
The instantiation and lifetime of an ara::core::Executor are subject to differentiated rules regarding exception safety and thread safety:
Copying: The copy constructor [SWS_CORE_00009] and the copy assignment operator [SWS_CORE_00017] are specified as thread-safe, but are classified as not exception safe. A copy operation may therefore fail if required resources cannot be allocated.
Moving: The move constructor [SWS_CORE_00015] and the move assignment [SWS_CORE_00018] are declared as noexcept and are thus exception-safe. However, move operations are not thread-safe (not thread-safe); hence, concurrent accesses during moving must be synchronized by the caller.
Destruction: Destructor [SWS_CORE_00019] is noexcept and implemented as thread-safe, allowing the lifecycle of an instance to be terminated safely.
Regarding concurrency during operation, a fundamental division becomes apparent: While oneway_execute[SWS_CORE_00025] is thread-safe, execute[SWS_CORE_00024] is classified as not thread-safe. The lack of thread safety in execute is likely attributable to the internal creation and management of the underlying state object for the resulting future, which is why concurrent invocations of execute on the same instance must be synchronized externally. Question Q-4425e6b07758230e (open)
Usage Path
Usage of ara::core::Executor is divided into two primary paths, depending on whether a return value is required:
Result-oriented path (execute): The caller passes a callable object f as well as optional arguments p... to execute[SWS_CORE_00024]. The method immediately returns a ara::core::Future whose result type is based on the deduced return type of the call. The callable is executed asynchronously in the guaranteed context. Once processing is complete, the caller can extract the result value or a potential error code from the future.
One-way path (oneway_execute): If the caller requires neither feedback nor synchronization, oneway_execute[SWS_CORE_00025] is invoked. The callable is likewise executed asynchronously, but no return value exists (void).
Sequence diagram: Asynchronous task processing via execute and result retrieval via future. Sources: [SWS_CORE_00024]
Error Scenarios
The invocation methods execute[SWS_CORE_00024] and oneway_execute[SWS_CORE_00025] do not throw C++ exceptions; both are explicitly specified as noexcept. Likewise, the specification for execute defines no standardized error codes for the dispatch invocation itself [SWS_CORE_00024].
If, however, an error occurs during the asynchronous execution of the callable, it is propagated via the ara::core::Future returned by execute: In the event of an error, the future encapsulates an error code, whereas in case of success, type ara::core::Result::value_type is provided with the function result [SWS_CORE_00024]. For oneway_execute[SWS_CORE_00025], by design there is no possibility of returning an error to the caller; errors remain within the asynchronous context.
This guide was curated by an AI and relies exclusively on the specification of AUTOSAR Adaptive R25-11.
Asynchronously invoke F with the provided arguments P....
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 9d31d266cefdProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The function execute of class ara::core::Executor serves for the asynchronous execution of a passed function object f together with the arguments p... ([SWS_CORE_00024]). As a return value, it provides a ara::core::Future, which in case of success encapsulates the result of the call or in case of error provides a corresponding error code ([SWS_CORE_00024]). The function itself is declared with the specifier noexcept.
Standardized error codes are not specified for the function call ([SWS_CORE_00024]). Regarding concurrency, although execute is classified as exception safe, it is explicitly considered not thread-safe ([SWS_CORE_00024]). Concurrent accesses to the same instance of ara::core::Executor are therefore likely to require synchronization at the user level. Question Q-6b839826a7d9742f (open)
The interplay with asynchronous control flows is evident in particular with chaining via then ([SWS_CORE_00337], [SWS_CORE_06237]). There, an executor context is passed, in whose context subsequent continuation functions are executed with the received ara::core::Result.
This text was automatically generated. All technical details are based on the specification AUTOSAR Adaptive R25-11.
ara::core::Future<std::invoke_result_t<std::decay_t< F >, std::decay_t< P >... > >
• If successful: an ara::core::Future containing a ara:: core::Result::value_type containing the result of the callable F • If unsuccessful: an ara::core::Future containing an Error Code
Fehler
Fehlercode
Beschreibung
This function does not specify any standardized errors.
Request a governed re-review of this record. The record is not changed immediately.
Asynchronously invoke F with the provided arguments P....
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 1e96ad32e48dProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Usage and Semantics
The template function oneway_execute of class ara::core::Executor is used for the asynchronous execution of a callable unit f (callable) with the passed arguments p...[SWS_CORE_00025]. Since the function does not yield a return value (return type void) and execution takes place asynchronously, the call returns immediately to the caller without waiting for the completion or a result of the execution [SWS_CORE_00025].
Error Handling and Exception Safety
The function is declared as noexcept and specified as exception-safe (exception safe) [SWS_CORE_00025]. Potential errors or exceptions within the passed callable must therefore presumably be caught and handled internally within the callable itself, as no error feedback or exception can be propagated to the calling context. Question Q-c8d31cfa9c2e3ab9 (open)
Concurrency and Limitations
According to the specification, oneway_execute is classified as thread-safe (thread-safe) [SWS_CORE_00025]. The function can thus be called concurrently from different threads on the same instance of ara::core::Executor. Inclusion is done via header file #include "ara/core/executor.h"[SWS_CORE_00025].
This usage note was generated automatically based on AUTOSAR R25-11.
gemini-3.8-flash-low· 2026-10-13 · German original