LargeBearCat
LargeBearCat

Reputation: 21

Android Native C++, work with threads

I want to execute some computation intensive C++ code through Android NDK. The C++ part will not directly access the harddisk or any peripherals. It will probably be necessary to put the C++ part into a thread because of long computations and because the app has other frequent duties to perform.

Is it possible to simply use Java threading in this case (e.g. a Java wrapper thread containing the C++ part)? Or do I need to create threads within the C++ part itself?

Upvotes: 2

Views: 475

Answers (1)

mah
mah

Reputation: 39807

You can choose which path to take but both are available. It's probably easier to create the new thread at the Java level, and then from within that thread just call into your native method... this won't require doing anything special at the C++ level.

Upvotes: 3

Related Questions