From 5feca399c2ef7e85bbbb84149326d0fdf0ac7c53 Mon Sep 17 00:00:00 2001 From: Ivan Epifanov Date: Wed, 27 Jan 2021 17:46:52 +0300 Subject: [PATCH] Nanosleep replacement --- common/threads.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/threads.h b/common/threads.h index b0bebd8d..26aef7ba 100644 --- a/common/threads.h +++ b/common/threads.h @@ -2,6 +2,9 @@ #define AL_THREADS_H #include +#ifdef __vita__ +#include +#endif #if defined(__GNUC__) && defined(__i386__) /* force_align_arg_pointer is required for proper function arguments aligning @@ -165,6 +168,13 @@ inline void althrd_yield(void) inline int althrd_sleep(const struct timespec *ts, struct timespec *rem) { +#ifdef __vita__ + if(sceKernelDelayThread(ts->tv_sec * 1000000 + ts->tv_nsec / 1000) != 0) + { + return -2; + } + return 0; +#else int ret = nanosleep(ts, rem); if(ret != 0) { @@ -172,6 +182,7 @@ inline int althrd_sleep(const struct timespec *ts, struct timespec *rem) errno = 0; } return ret; +#endif }