util: os_time: add Fuchsia support
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29539>
This commit is contained in:
+5
-5
@@ -39,7 +39,7 @@
|
||||
|
||||
#include "util/u_atomic.h"
|
||||
|
||||
#if DETECT_OS_POSIX
|
||||
#if DETECT_OS_POSIX_LITE
|
||||
# include <unistd.h> /* usleep */
|
||||
# include <time.h> /* timeval */
|
||||
# include <sys/time.h> /* timeval */
|
||||
@@ -65,7 +65,7 @@ os_time_get_nano(void)
|
||||
void
|
||||
os_time_sleep(int64_t usecs)
|
||||
{
|
||||
#if DETECT_OS_LINUX || DETECT_OS_MANAGARM
|
||||
#if DETECT_OS_LINUX || DETECT_OS_MANAGARM || DETECT_OS_FUCHSIA
|
||||
struct timespec time;
|
||||
time.tv_sec = usecs / 1000000;
|
||||
time.tv_nsec = (usecs % 1000000) * 1000;
|
||||
@@ -118,7 +118,7 @@ os_wait_until_zero(volatile int *var, uint64_t timeout)
|
||||
|
||||
if (timeout == OS_TIMEOUT_INFINITE) {
|
||||
while (p_atomic_read(var)) {
|
||||
#if DETECT_OS_POSIX
|
||||
#if DETECT_OS_POSIX_LITE
|
||||
sched_yield();
|
||||
#endif
|
||||
}
|
||||
@@ -132,7 +132,7 @@ os_wait_until_zero(volatile int *var, uint64_t timeout)
|
||||
if (os_time_timeout(start_time, end_time, os_time_get_nano()))
|
||||
return false;
|
||||
|
||||
#if DETECT_OS_POSIX
|
||||
#if DETECT_OS_POSIX_LITE
|
||||
sched_yield();
|
||||
#endif
|
||||
}
|
||||
@@ -154,7 +154,7 @@ os_wait_until_zero_abs_timeout(volatile int *var, int64_t timeout)
|
||||
if (os_time_get_nano() >= timeout)
|
||||
return false;
|
||||
|
||||
#if DETECT_OS_POSIX
|
||||
#if DETECT_OS_POSIX_LITE
|
||||
sched_yield();
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user