I've got a bit of Android NDK code that's called from Xamarin. Simple stuff that returns directly is OK, but when I create a background thread I get a SIGABRT (-6)
and the app dies.
The background thread is created with std::thread(lambda)
. A background NDK thread is needed because this code has to unpack a very large data file and then run some CPU-intensive algorithms using the unpacked data.
Now SIGABRT appears to originate from libc, which supposedly is the symptom of an Application Not Responding. Yet this is supposed to affect only the main thread? In the developer options, I do have "show all ANR" options enabled, but that only blinks a few red frames around the stock Android software.
Why does Android confuse my background thread and the foreground thread? How do I tell Android not to kill my background thread?
Android v5.1.1 on stock Google/LG Nexus 5.