Quantcast
Channel: Active questions tagged autosar - Stack Overflow
Viewing all articles
Browse latest Browse all 101

Confused about AUTOSAR AP accessing to method result

$
0
0

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:)


Viewing all articles
Browse latest Browse all 101

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>