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
c ++ android asynchronous c ++ 11 android-ndk


source to share


No one has answered this question yet

See similar questions:

2
NDK r9c - does not support std :: future

or similar:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to persist android activity state by persisting instance state?
2437
Why "using the std namespace;" considered bad practice?
2097
Is there a way to run Python on Android?
1844
What is "Context" on Android?
957
How and when to use "async and await"
49
Why should I use std :: async?



All Articles
Loading...
X
Show
Funny
Dev
Pics