AUTOSAR AP defines Request&Response approachs for users, its format just like this
ara::core::Future<Output> user_defined_method(Input in)
As you see, AUTOSAR AP uses Future to wrap output and standars describes two concepts to access output: Event-driven and polling
Event-driven
Usage like
...auto fut = obj.user_defined_method(input data);auto output_value = fut.get(); // or fut.GetResult(), both will block current thread until fut' state changs to ready...
AUTOSAR calls this way Event-driven !!!???, confuse me very much.
polling
Usage like this
auto fut = obj.user_defined_method(input data);while (!fut.is_ready()) { sleep(xxx);}// Being here means that fut state is readyauto output_val = fut.get(); // or fut.GetResult(), both will return immediately.
AUTOSAR calls this as no-blocking !!!??? confuse me very much again
Beside above, there is another interface:
template <typename F>auto Future::then(F && func) -> see autosar definition {}
can somebody help me to understand where to use this approach, thank you:)