diff options
Diffstat (limited to 'libjava/include')
-rw-r--r-- | libjava/include/posix.h | 6 | ||||
-rw-r--r-- | libjava/include/win32.h | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/libjava/include/posix.h b/libjava/include/posix.h index cdcdb5d..859db6e 100644 --- a/libjava/include/posix.h +++ b/libjava/include/posix.h @@ -60,6 +60,12 @@ _Jv_platform_close_on_exec (jint fd) ::fcntl (fd, F_SETFD, FD_CLOEXEC); } +inline void +_Jv_platform_usleep (unsigned long usecs) +{ + usleep (usecs); +} + #ifndef DISABLE_JAVA_NET #ifndef HAVE_SOCKLEN_T diff --git a/libjava/include/win32.h b/libjava/include/win32.h index d4c0ab6..8ba6ef2 100644 --- a/libjava/include/win32.h +++ b/libjava/include/win32.h @@ -48,6 +48,19 @@ _Jv_platform_close_on_exec (jint) // Ignore. } +/* Suspends the execution of the current thread for the specified + number of microseconds. Tries to emulate the behaviour of usleep() + on UNIX and provides a granularity of 1 millisecond. */ +inline void +_Jv_platform_usleep (unsigned long usecs) +{ + if (usecs > 0UL) + { + unsigned long millis = ((usecs + 999UL) / 1000UL); + Sleep (millis); + } +} + #ifndef DISABLE_JAVA_NET static inline int |