Under Android NDK, is there a sleep() function which sleeps for X miliseconds, but do not block the event loop?
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.
The Native Development Kit (NDK) is a set of tools that allows you to use C and C++ code with Android, and provides platform libraries you can use to manage native activities and access physical device components, such as sensors and touch input.
Sleep () FunctionC++ language does not provide a sleep function of its own. However, the operating system's specific files like unistd. h for Linux and Windows. h for Windows provide this functionality.
Turning @mreichelt commment into an answer:
Yes there is a sleep(seconds)
function.
Add #include <unistd.h>
Call: sleep(seconds)
or usleep(microseconds)
note: A microsecond (us or Greek letter mu plus s) is one millionth (10 -6 ) of a second, while a millisecond (ms or msec) is one thousandth of a second
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With