Std :: async problems depending on android version

I am currently developing my own app that can run on Android devices from API 14. I am using std :: async in my code and so far it has not caused problems with API 16 devices for API 19, but API 14 and 15 lead yourself in a different way:

  • When I use std :: launch :: async, the function fails. Calling wait () on the returned std :: future will block forever.
  • When I don't install the policy, it works. (I assume it uses deferred).

Example:

std::async(std::launch::async, &foo) <-- never running foo
std::async(&foo) <-- runs foo

      

If I run Image API 16 on the same device async works as expected.

I am using CLang3.4 and the latest toolchain.

I also use gnustl_static.

I have read similar problems, for example: NDK r9c - does not support std :: future where the user reports that the LG phone does not start the second task until the first one is finished.

Two questions:

  • Why does the different behavior depend on the Android version?
  • If I link the same gnustd_static library, why does std :: async behave differently?
+3


source to share





All Articles