开发者

Creating threads using the NDK?

开发者 https://www.devze.com 2023-04-01 01:35 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号