Scheduling native threads at Android NDK
This recipe discusses how to schedule native threads at Android NDK.
Getting ready...
Readers are suggested to read the Manipulating classes in JNI and Calling static and instance methods from native code recipes in Chapter 2, Java Native Interface, and Creating and terminating native threads at Android NDK recipe in this chapter.
How to do it...
The following steps will help us create an Android project that demonstrates threads scheduling at Android NDK:
Create an Android application named
NativeThreadsSchedule
. Set the package name ascookbook.chapter6.nativethreadsschedule
. Refer to the Loading native libraries and registering native methods recipe in Chapter 2, Java Native Interface for more detailed instructions.Right-click on the project NativeThreadsSchedule, select Android Tools | Add Native Support.
Add a Java file named
MainActivity.java
under packagecookbook.chapter6.nativethreadsschedule
. This Java file simply loads the native libraryNativeThreadsSchedule...