Creating threads using the NDK?
I've been looking into writing a small cross-platform OpenGL/helper code that can compile on Android and the iPhone. I was looking up the best way to handle multiple threads within the NDK on Android and couldn't find a definitive answer. I开发者_JAVA技巧 read that fork() should not be used because Android doesn't keep tabs on those processes.
I'm not worried about making the forking cross-platform as it can be easily defined separately. So, I was wondering if anyone knew the best way to handle creation and management of multiple threads within the NDK.
According to NDK/JNI: identifying current thread , Java threads on Android correspond to pthreads. So consider using those. The relevant C headers do come with NDK.
Not sure how will calling Java back from those threads work. I won't automatically assume that the JNI pointer is thread-safe.
精彩评论