diff options
Diffstat (limited to 'src/util/thread')
| -rw-r--r-- | src/util/thread/thread.h | 2 | ||||
| -rw-r--r-- | src/util/thread/thread_linux.c | 6 | ||||
| -rw-r--r-- | src/util/thread/thread_windows.c | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/util/thread/thread.h b/src/util/thread/thread.h index 8860d2d..6a04647 100644 --- a/src/util/thread/thread.h +++ b/src/util/thread/thread.h @@ -47,7 +47,7 @@ typedef unsigned long aki_thread_result; typedef aki_thread_result (AKI_THREADCALL * aki_thread_func)(void *); -void aki_thread_sleep(aki_os_tstamp ts); +void aki_thread_sleep(aki_os_tstamp delay); void aki_thread_create(struct aki_thread *thread, aki_thread_func func, void *userdata); void aki_thread_join(struct aki_thread *thread); diff --git a/src/util/thread/thread_linux.c b/src/util/thread/thread_linux.c index e1d694c..6df84e9 100644 --- a/src/util/thread/thread_linux.c +++ b/src/util/thread/thread_linux.c @@ -4,11 +4,11 @@ #include "thread.h" -void aki_thread_sleep(aki_os_tstamp ts) +void aki_thread_sleep(aki_os_tstamp delay) { struct timespec tv; - tv.tv_sec = (s64)ts; - tv.tv_nsec = (s64)((ts - tv.tv_sec) * 1e9); + tv.tv_sec = (s64)delay; + tv.tv_nsec = (s64)((delay - tv.tv_sec) * 1e9); while (nanosleep(&tv, &tv) == -1 && errno == EINTR) {} } diff --git a/src/util/thread/thread_windows.c b/src/util/thread/thread_windows.c index 9ea9ead..a58e1b1 100644 --- a/src/util/thread/thread_windows.c +++ b/src/util/thread/thread_windows.c @@ -2,11 +2,11 @@ NTSTATUS(__stdcall *NtDelayExecution)(BOOL Alertable, PLARGE_INTEGER DelayInterval); -void aki_thread_sleep(aki_os_tstamp ts) +void aki_thread_sleep(aki_os_tstamp delay) { - LARGE_INTEGER intr; - intr.QuadPart = -1 * (s64)(ts * 1e7); - NtDelayExecution(false, &intr); + LARGE_INTEGER li; + li.QuadPart = -(s64)(delay * 1e7L); + NtDelayExecution(false, &li); } void aki_thread_create(struct aki_thread *thread, aki_thread_func func, void *userdata) |