是否有睡眠()函数为Android NDK?函数、睡眠、NDK、Android

2023-09-06 13:31:11 作者:为你活这。|活这为你。

在的Andr​​oid NDK,有一个睡眠()函数,睡对于x毫秒为单位,但不阻塞事件循环?

Under Android NDK, is there a sleep() function which sleeps for X miliseconds, but do not block the event loop?

我们正在编写API的测试工作在Mac,Windows和Android系统。到目前为止,我们已经实施了某种形式的睡眠(),适用于Mac和Windows,但我们都是新来的Andr​​oid NDK,需要一些帮助那里。谢谢你在前进。

We are writing API tests to work on Mac, Windows, and Android. So far, we have implemented some sort of sleep() for Mac and Windows, but we are all new to Android NDK and need some help there. Thank you in advance.

推荐答案

所以,你正在寻找一个睡眠()方法确实睡了一定的时间,但不堵塞事件循环?这听起来很奇怪,我。我想你可能想使用一个新的线程,而不是与调用sleep()方法存在 - 而无需使用任何JNI

So you are looking for a sleep() method that does sleep for a certain amount of time but does not block the event loop? This sounds odd to me. I think you might want to use a new thread instead and call the sleep() method there - without having to use any JNI.