user1619571
user1619571

Reputation: 51

Make Java calls from JNI during native signal handling

I implement a custom POSIX signal handler Ref : http://blog.httrack.com/blog/2013/08/23/catching-posix-signals-on-android/

Their appears to be a platform limitation with ART.

Is there a work around or any other way to achieve, calling java method from JNI through the signal handler method.

If not then is there an alternative scheme to catch the native crash and propagate to the app ?

Upvotes: 2

Views: 539

Answers (1)

Sergio
Sergio

Reputation: 8209

First of all - you should be very carefully with what you doing in signal handler. Also there is a list of functions that you can safely invoke from there, look for "Async-signal-safe functions". And surely you shouldn't invoke anything outside of that list or anythyng via JNIEnv because you don't know what JVM does under the hood.

As result there is no way to propagate error to the app. You can just write anything you want to some file with write() and then test this file at next launch.

Upvotes: 1

Related Questions