是否有睡眠()函数为Android NDK? [英] Is there a sleep() function for Android NDK?

查看:777
本文介绍了是否有睡眠()函数为Android NDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在的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.

这篇关于是否有睡眠()函数为Android NDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆