kernel: Make sceKernelUsleep interruptible

This commit is contained in:
IndecisiveTurtle 2024-06-21 17:39:37 +03:00 committed by georgemoralis
parent 8850c2f4be
commit 7bdaeafdfd
1 changed files with 13 additions and 3 deletions

View File

@ -56,10 +56,20 @@ int PS4_SYSV_ABI sceKernelUsleep(u32 microseconds) {
} else { } else {
std::this_thread::sleep_for(std::chrono::microseconds(microseconds)); std::this_thread::sleep_for(std::chrono::microseconds(microseconds));
} }
#else
usleep(microseconds);
#endif
return 0; return 0;
#else
timespec start;
timespec remain;
start.tv_sec = microseconds / 1000000;
start.tv_nsec = (microseconds % 1000000) * 1000;
timespec* requested = &start;
int ret = 0;
do {
ret = nanosleep(requested, &remain);
requested = &remain;
} while (ret != 0);
return ret;
#endif
} }
int PS4_SYSV_ABI posix_usleep(u32 microseconds) { int PS4_SYSV_ABI posix_usleep(u32 microseconds) {