Enables waiting for the completion of an asynchronous operation without a return value and retrieving the error status.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e943c154e07eProvenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Enables waiting for the completion of an asynchronous operation without a return value and retrieving the error status.
The class ara::core::Future<void, E> enables asynchronous synchronization and error checking for operations without a return value in AUTOSAR Adaptive [SWS_CORE_06236]. As a non-copyable type, it allows waiting for completion as well as exception-safe result retrieval as ara::core::Result<void, E>[SWS_CORE_06236] or asynchronous continuation via a continuation function [SWS_CORE_06231]. After retrieving the result, the shared state is invalidated such that subsequent calls without a valid state constitute a violation [SWS_CORE_06236].
Context
The template class specialization ara::core::Future<void, E> represents the receiving end of an asynchronous operation in AUTOSAR Adaptive that does not return a value upon successful completion, but purely signals the occurrence of the event or an error that occurred. According to the class description, the implementation must terminate the condition E != ara::core::ErrorCode with a compilation error. The class typically interacts with a corresponding ara::core::Promise, which populates the shared state [SWS_CORE_06236], as well as with asynchronous execution contexts when registering continuation functions [SWS_CORE_06237].
Lifecycle
Instances of ara::core::Future<void, E> are move-only objects: the copy constructor [SWS_CORE_06234] and copy assignment operator [SWS_CORE_06235] are deleted (delete). An object created via the default constructor has no shared state and behaves analogously to std::future[SWS_CORE_06222]. By means of move construction [SWS_CORE_06223] or move assignment [SWS_CORE_06225], an instance takes ownership of a shared state from another instance.
The lifecycle is largely defined by the state of the shared state. Via the method valid(), it can be checked whether the instance is bound to a shared state and thus usable [SWS_CORE_06227]. As soon as the result is retrieved by means of GetResult()[SWS_CORE_06236] or get()[SWS_CORE_06226], or a continuation is registered via then()[SWS_CORE_06231], the future object loses its shared state and valid() returns false. The destructor releases any remaining shared state [SWS_CORE_06233]. With regard to concurrency, inspection and destruction operations such as valid()[SWS_CORE_06227], is_ready()[SWS_CORE_06232], and the destructor [SWS_CORE_06233] are thread-safe, whereas state-mutating operations such as GetResult()[SWS_CORE_06236], get()[SWS_CORE_06226], and the waiting functions [SWS_CORE_06228] are not thread-safe.
In the synchronous usage path, a consumer waits for the completion of the asynchronous operation. With is_ready(), it can be queried in a low-blocking manner whether a value or an error is present [SWS_CORE_06232]. Alternatively, blocking wait can be performed by means of wait()[SWS_CORE_06228], or with a time limit via wait_for()[SWS_CORE_06229] and wait_until()[SWS_CORE_06230]. Once the result is available, value retrieval is preferably performed in an exception-safe manner via GetResult(), whereby a ara::core::Result<void, E> is returned [SWS_CORE_06236].
In the asynchronous path, the method then() allows registering a continuation function that is executed as soon as the result is available [SWS_CORE_06231]. An execution context (Executor) can optionally be passed here [SWS_CORE_06237]. The continuation takes the Result<void, E> as an rvalue. The return type of then() automatically unwraps nested Future or Result types [SWS_CORE_06231].
If a state-dependent operation (such as GetResult(), is_ready(), wait(), wait_for(), wait_until(), or then()) is called on an invalid instance (valid() == false), a precondition violation occurs, which is handled as FutureInvalidViolation[SWS_CORE_06228], [SWS_CORE_06229], [SWS_CORE_06230], [SWS_CORE_06231], [SWS_CORE_06232], [SWS_CORE_06236], [SWS_CORE_06237]. Calling get() on an invalid instance instead throws a FutureException with the error code kNoState[SWS_CORE_06226]; get() does not participate in overload resolution when C++ exceptions are disabled [SWS_CORE_06226].
If the corresponding promise was destroyed or has abandoned the shared state without setting a result or an explicit error, the error code FutureErrc::kBrokenPromise is stored in the shared state according to [SWS_CORE_00400][SWS_CORE_06226], [SWS_CORE_06236]. This is returned by GetResult() as an error in the Result<void, E>[SWS_CORE_06236]. If a continuation registered in then() throws an exception that does not implement a violation, this leads to FutureContinuationHasThrownViolation[SWS_CORE_06231], [SWS_CORE_06237].
This guide is based exclusively on the AUTOSAR specification for ara::core::Future<void, E> in release R25-11.
Returns nothing. This function shall behave the same as the corresponding std::future function. Part of the behavior taken from the std::future is that after a call to this function the Future is not valid anymore (valid() == false). ≙ std::future
Get the result. Similar to Future::get(), this call blocks until the value or an error is available. However, this call will never throw an exception. Part of the behavior taken from Future::get() is that after a call to this function the Future is not valid anymore (valid() == false).
Return whether the asynchronous operation has finished. If this function returns true, get(), Get Result() and the wait calls are guaranteed not to block.
Create a new Future with the content returned by func when passed the Result of this Future. func may be called in the context of this call or in the context of Promise::set_value() or Promise::SetError() or somewhere else. valid() == false on the original future object immediately after it returns. The Callable input argument "func" takes a Result<void,E> object as parameter. This will be the Result obtained via GetResult from the Future instance itself, on which .then() is being called. The Result is passed to func as an rvalue expression. The return type of then depends on the return type of func (aka continuation). Let U be the return type of the continuation (i.e. a type equivalent to std::invoke_result_ t<std::decay_t<F>,Result<void,E>>). • If U is Future<T2,E2> for some types T2, E2, then the return type of then() is Future<T2,E2>. This is known as implicit Future unwrapping. • If U is Result<T2,E2> for some types T2, E2, then the return type of then() is Future<T2,E2>. This is known as implicit Result unwrapping. • Otherwise it is Future<U,E>. Continuations that are registered with Future::then() are registered in the Future F that Future::then() returns. No such continuation shall be executed after the destructor of the Future F returns. A continuation that is already being executed shall run to completion. Note: that means that the destructor of Future might block until the currently running continuation has been completed. The continuation shall not throw, except for the purpose of implementing a Violation. Note: Exceptions can be used within the continuation, however if they do not realize a Violation, they must not escape the continuation. Note: Users who need to propagate information from closures’ exceptions should translate them to an error and return an ara::core::Result or ara::core::Future from the continuation with the error stored in it. ≙ std::invoke_result_
Overloadsthen2
template <typename F> auto then (F &&func) noexcept -> Future< <see below> >;SWS_CORE_06231
template <typename F, typename ExecutorT> auto then (F &&func, ExecutorT &&executor) noexcept -> Future< <see below> >;SWS_CORE_06237
Wait for the given period, or until a value or an error is available. This function shall behave the same as the corresponding std::future function ≙ std::future
Wait until the given time, or until a value or an error is available. This function shall behave the same as the corresponding std::future function. ≙ std::future
Get the result. Similar to Future::get(), this call blocks until the value or an error is available. However, this call will never throw an exception. Part of the behavior taken from Future::get() is that after a call to this function the Future is not valid anymore (valid() == false).
a Result as std::move(result from the shared state) with either a value or an error that has been put into the corresponding Promise. This can be because either: • explicit setting of the Error via Promise::SetError / Promise::Set Result or • the Promise was broken, meaning the shared state was abandoned by the corresponding Promise. Then the error is kBrokenPromise as defined in [SWS_CORE_00400]
Returns nothing. This function shall behave the same as the corresponding std::future function. Part of the behavior taken from the std::future is that after a call to this function the Future is not valid anymore (valid() == false).
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 195e9e272b48Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The member function get of the specialization ara::core::Future<void, E> serves to wait for the result of an asynchronous operation without a return value ([SWS_CORE_06226]). It behaves like the corresponding function of std::future and blocks the caller until the result or an error is ready ([SWS_CORE_06226], [SWS_CORE_00336]). After the call, the future instance loses its validity, so that valid() == false holds ([SWS_CORE_06226]).
The function is declared as not exception-safe (not exception safe) ([SWS_CORE_06226]). If an error was stored in the associated Promise, a corresponding exception is raised ([SWS_CORE_06226]). If the shared state was abandoned prematurely, the error code kBrokenPromise according to [SWS_CORE_00400] occurs ([SWS_CORE_06226]). If get is executed on an already invalid instance, the function throws a FutureException with the error code kNoState ([SWS_CORE_06226]).
Regarding concurrency, the method is not thread-safe (not thread-safe) ([SWS_CORE_06226]). Concurrent accesses to the same object therefore require external synchronization. Furthermore, the function does not participate in overload resolution if C++ exceptions are disabled in the compiler toolchain ([SWS_CORE_06226]).
In interaction with related functions, [SWS_CORE_00332] (is_ready) ensures that get is guaranteed not to block if the operation has already completed. For contexts without exceptions, AUTOSAR provides [SWS_CORE_00336] (GetResult) as an alternative, which reports errors via a result type instead of throwing exceptions.
This text was generated by an AI and serves as an orientation guide; the AUTOSAR specification is authoritative.
Any exception of the type associated with the error that has been put into the corresponding Promise. This can be because either: • explicit setting of the Error via: Promise::SetError(E&&) Promise::SetError(const E&) / Promise::SetResult(const Result<T, E>&) Promise::SetResult(Result <T, E>&&) • the Promise was broken, meaning the shared state was abandoned by the corresponding Promise. Then the error is kBrokenPromise as defined in [SWS_CORE_00400]. FutureException in case the Future is invalid. The contained ErrorCode is kNoState
Hinweise: This function shall not participate in overload resolution when C++ exceptions are disabled in the compiler toolchain
Request a governed re-review of this record. The record is not changed immediately.
Return whether the asynchronous operation has finished. If this function returns true, get(), Get Result() and the wait calls are guaranteed not to block.
template <typename F> auto then (F &&func) noexcept -> Future< <see below> >;
Create a new Future with the content returned by func when passed the Result of this Future. func may be called in the context of this call or in the context of Promise::set_value() or Promise::SetError() or somewhere else. valid() == false on the original future object immediately after it returns. The Callable input argument "func" takes a Result<void,E> object as parameter. This will be the Result obtained via GetResult from the Future instance itself, on which .then() is being called. The Result is passed to func as an rvalue expression. The return type of then depends on the return type of func (aka continuation). Let U be the return type of the continuation (i.e. a type equivalent to std::invoke_result_ t<std::decay_t<F>,Result<void,E>>). • If U is Future<T2,E2> for some types T2, E2, then the return type of then() is Future<T2,E2>. This is known as implicit Future unwrapping. • If U is Result<T2,E2> for some types T2, E2, then the return type of then() is Future<T2,E2>. This is known as implicit Result unwrapping. • Otherwise it is Future<U,E>. Continuations that are registered with Future::then() are registered in the Future F that Future::then() returns. No such continuation shall be executed after the destructor of the Future F returns. A continuation that is already being executed shall run to completion. Note: that means that the destructor of Future might block until the currently running continuation has been completed. The continuation shall not throw, except for the purpose of implementing a Violation. Note: Exceptions can be used within the continuation, however if they do not realize a Violation, they must not escape the continuation. Note: Users who need to propagate information from closures’ exceptions should translate them to an error and return an ara::core::Result or ara::core::Future from the continuation with the error stored in it.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 161f9bad96abProvenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
use
The method then registers a follow-up operation (continuation func) on a ara::core::Future<void, E> instance [SWS_CORE_06231]. The callable object takes the result of the operation as an rvalue expression of type Result<void, E>, which is provided internally via GetResult[SWS_CORE_06231]. The call of func can take place synchronously in the context of then or asynchronously in the context of Promise::set_value(), Promise::SetError(), or elsewhere [SWS_CORE_06231].
Immediately after return from then, the original future is invalid (valid() == false) [SWS_CORE_06231]. The return type adapts to the return type U of the continuation:
If func returns a Future<T2, E2>, implicit unwrapping occurs and then returns Future<T2, E2>[SWS_CORE_06231].
If func returns a Result<T2, E2>, this is likewise implicitly unwrapped to Future<T2, E2>[SWS_CORE_06231].
In all other cases, the return type is Future<U, E>[SWS_CORE_06231].
Error Handling and Boundary Conditions
Standardized error codes are not specified for this function [SWS_CORE_06231]. The method is declared as noexcept, but defines two violations:
FutureInvalidViolation: Occurs when the method is called on an invalid future (if valid() returns false) [SWS_CORE_06231].
FutureContinuationHasThrownViolation: Occurs when the continuation throws an exception that does not implement a violation [SWS_CORE_06231]. Errors in the continuation must instead be returned wrapped in a Result or Future[SWS_CORE_06231].
Concurrency and Interaction
The method is not thread-safe (not thread-safe) [SWS_CORE_06231]. After the return of the destructor of the returned future, no registered continuation will be executed anymore; however, an execution that is already running will be completed, so the destructor may block [SWS_CORE_06231]. While [SWS_CORE_06231] applies to Future<void, E>, [SWS_CORE_00331] describes the variant for typed futures Future<T, E> and [SWS_CORE_06237] describes the overload with an explicit executor.
This text was generated by an AI based on the AUTOSAR specification.
FutureInvalidVio- If the Future is invalid (valid returns false) lation FutureContinua- If the continuation throws an exception tionHasThrownVio- lation
template <typename F, typename ExecutorT> auto then (F &&func, ExecutorT &&executor) noexcept -> Future< <see below> >;
Create a new Future with the content returned by func when passed the Result of this Future. func is called in the context of the provided execution context executor. valid() == false on the original future object immediately after it returns. The Callable input argument "func" takes a Result<void,E> object as parameter. This will be the Result obtained via GetResult from the Future instance itself, on which .then() is being called. The Result is passed to func as an rvalue expression. The return type of then depends on the return type of func (aka continuation). Let U be the return type of the continuation (i.e. a type equivalent to std::invoke_result_ t<std::decay_t<F>,Result<void,E>>). • If U is Future<T2,E2> for some types T2, E2, then the return type of then() is Future<T2,E2>. This is known as implicit Future unwrapping. • If U is Result<T2,E2> for some types T2, E2, then the return type of then() is Future<T2,E2>. This is known as implicit Result unwrapping. • Otherwise it is Future<U,E>. Continuations that are registered with Future::then() are registered in the Future F that Future::then() returns. No such continuation shall be executed after the destructor of the Future F returns. A continuation that is already being executed shall run to completion. Note: that means that the destructor of Future might block until the currently running continuation has been completed. The continuation shall not throw, except for the purpose of implementing a Violation. Note: Exceptions can be used within the continuation, however if they do not realize a Violation, they must not escape the continuation. Note: Users who need to propagate information from closures’ exceptions should translate them to an error and return an ara::core::Result or ara::core::Future from the continuation with the error stored in it.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 96d3b0e93b60Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The function then registers a callable continuation object func on an instance of ara::core::Future<void, E> for execution in the specified execution context executor[SWS_CORE_06237]. Immediately after the return of then, the calling future instance loses its validity such that valid() == false is [SWS_CORE_06237]. The continuation is passed the result of the original future instance as Result<void, E> in the form of an rvalue expression [SWS_CORE_06237]. As return value, the call delivers a new Future instance, where return types of the continuation of type Future<T2, E2> or Result<T2, E2> are implicitly unwrapped to Future<T2, E2>; otherwise, a Future<U, E> is returned [SWS_CORE_06237].
Regarding concurrency and lifecycle, the function is specified as not thread-safe (not thread-safe) [SWS_CORE_06237]. The continuation is registered in the newly returned future. After return of the destructor of this new future, no continuation may be executed anymore; however, a continuation already being executed runs to completion, which is why the destructor of the future can block [SWS_CORE_06237].
The function does not declare standardized error codes and is defined as noexcept[SWS_CORE_06237]. If called on an invalid future instance, the violation FutureInvalidViolation is present [SWS_CORE_06237]. If the continuation throws an exception, this leads to violation FutureContinuationHasThrownViolation[SWS_CORE_06237]. Exceptions must not leave the continuation, but must be translated into error values if necessary and returned within a Result or Future[SWS_CORE_06237]. The function complements the executorless variant [SWS_CORE_06231] and forms the counterpart to the value-bearing overloads [SWS_CORE_00331] and [SWS_CORE_00337].
This usage note was created by an AI and is based on the AUTOSAR specification R25-11.
FutureInvalidVio- If the Future is invalid (valid returns false) lation FutureContinua- If the continuation throws an exception. tionHasThrownVio- lation
Template-Parameter
Parameter
Beschreibung
FExecutorT
the type of the func argument the type of the executor argument
Parameter (in)
Parameter
Beschreibung
func
a callable to register
executor
the execution context in which to execute the Callable func
Checks if the Future is valid, i.e. if it has a shared state.
This function shall behave the same as the corresponding std::future function.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 480112e5c811Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Function valid() checks synchronously whether the instance of ara::core::Future<void, E> has a shared state and is thus usable [SWS_CORE_06227]. According to the specification, it behaves analogously to the corresponding function from std::future[SWS_CORE_06227]. As return value, it returns true if the future is usable, and false if it is not usable [SWS_CORE_06227].
Regarding concurrency and error handling, the method is declared as noexcept, exception-safe (exception safe), and explicitly specified as thread-safe (thread-safe) [SWS_CORE_06227]. It can thus be safely called from concurrent contexts.
In interplay with other operations, valid() serves to protect the lifecycle:
If an operation such as wait()[SWS_CORE_06228] or is_ready()[SWS_CORE_00332] is called on an invalid future object (valid() == false), this raises violation FutureInvalidViolation.
Consuming operations invalidate the object: After a call to get(), the future is no longer valid, so subsequent checks with valid() yield the value false[SWS_CORE_06226].
Likewise, forwardings via then()[SWS_CORE_00331] or calls to GetResult()[SWS_CORE_00336] cause the original future object to be immediately invalidated.
This usage note was generated by an AI based on the specification.
Wait for a value or an error to be available. This function shall behave the same as the corresponding std::future function
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2f9ee5ecd1d4ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The member function wait of the specialization ara::core::Future<void, E> blocks the calling thread synchronously until the result of the asynchronous operation is available in the form of a value or an error [SWS_CORE_06228]. The function takes no parameters, returns no return value (void), and behaves according to the specification like the corresponding function of std::future[SWS_CORE_06228].
Regarding error handling and constraints, the following requirements apply:
Exception safety and error handling: The operation is declared with noexcept and specified as exception safe (exception safe) [SWS_CORE_06228]. If valid() returns false for the future instance, the violation FutureInvalidViolation is present [SWS_CORE_06228]. The specific consequence of this violation is likely implemented as system-specific error handling of the AUTOSAR runtime environment. Question Q-469e9abc947b9869 (open)
Concurrency: The function is classified as not thread-safe (not thread-safe) [SWS_CORE_06228]. Concurrent access to the same future object without external synchronization is therefore not permitted.
In interaction with the other functions of module core, the following possibilities exist:
With the thread-safe method is_ready, it can be queried in advance whether the operation has completed; upon returning true, wait is guaranteed not to block anymore [SWS_CORE_06232].
To avoid endless blocking, the time-bounded functions wait_for with a relative duration [SWS_CORE_06229] and wait_until with an absolute point in time [SWS_CORE_06230] are available.
The same synchronous waiting requirements and restrictions apply to the primary template class ara::core::Future[SWS_CORE_00328].
This text was curated by an AI system and is based exclusively on the AUTOSAR specification.
Wait for the given period, or until a value or an error is available. This function shall behave the same as the corresponding std::future function
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 927a98d78cf3ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The method wait_for of specialization ara::core::Future<void, E> synchronously blocks the calling thread for a maximum duration timeoutDuration or until the result is available [SWS_CORE_06229]. It behaves semantically like the corresponding standard function std::future::wait_for[SWS_CORE_06229].
As return value, the function delivers the status FutureStatus[SWS_CORE_06229]. This signals with FutureStatus::kReady that a value or an error is available, or with FutureStatus::kTimeout that the deadline has expired without a result [SWS_CORE_00361]. A state equivalent to std::future_status::deferred is not provided [SWS_CORE_00361]. The behavior corresponds to the general future interface [SWS_CORE_00329].
The following conditions regarding concurrency and error handling apply to the call:
Concurrency: The function is specified as not thread-safe (not thread-safe) [SWS_CORE_06229]. Concurrent calls on the same instance must be protected by the caller.
Error cases and exception safety: The operation is declared as exception safe (exception safe) and noexcept[SWS_CORE_06229]. If the Future object is invalid (valid() returns false), a FutureInvalidViolation is present [SWS_CORE_06229]. Because of the noexcept declaration, this violation will presumably lead to immediate program termination. Question Q-4f01aa6e7fbfb12d (open)
This usage note was created automatically based on the specification of AUTOSAR Adaptive R25-11.
Wait until the given time, or until a value or an error is available. This function shall behave the same as the corresponding std::future function.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 932b0d674f17Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The member function wait_until of specialization ara::core::Future<void, E> blocks the calling thread until the specified absolute time point deadline is reached or a value or an error is available [SWS_CORE_06230]. The function exhibits the same behavior as the corresponding C++ standard function std::future::wait_until[SWS_CORE_06230] and has the same semantics as the generic overload for ara::core::Future[SWS_CORE_00330].
The return value of type FutureStatus signals whether the deadline was reached or a value is available [SWS_CORE_06230]. Here, state kReady indicates that the shared state is ready, while kTimeout means that the shared state did not become ready before expiration of the deadline [SWS_CORE_00361]. A state analogous to std::future_status::deferred does not exist in FutureStatus[SWS_CORE_00361].
Regarding execution and boundary conditions, the following requirements are defined:
Call context and exception behavior: The function is available via header file #include "ara/core/future.h", declared as noexcept, and specified as exception safe (exception safe) [SWS_CORE_06230].
Error states: If the future is invalid, that is, if valid() returns the value false, the violation FutureInvalidViolation is present [SWS_CORE_06230].
Concurrency: The operation is classified as not thread-safe (not thread-safe) [SWS_CORE_06230].
This usage note was generated automatically based on the AUTOSAR Adaptive R25-11 specification.
gemini-3.8-flash-low· 2026-10-13 · German original