Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android JNI functions run on main thread?

I have a doubt regarding JNI function calls made from Android. Do they run on the same thread as the Android app? Will the UI freeze if the native function is taking more time to run?

like image 929
Shamy Avatar asked May 08 '12 06:05

Shamy


1 Answers

JNI calls are synchronous, like any other Java call, you can switch or spawn threads, but if you didn't specify it, they are executed on the same thread. So if you call a JNI function from the UI thread, it will be blocked until the function returns.

like image 110
MByD Avatar answered Oct 07 '22 01:10

MByD