summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-07 01:57:14 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-07 01:57:14 (GMT)
commit0abd9b7f252129aae0c3f164e64dcb8479f661bc (patch)
tree0a5272569d2e9cd8dff1eee82daf942ac1143710 /thread_win32.c
parentb16eaf86324b000c4c349e072e15b97dde701e48 (diff)
thread.c: favor timespec internally
This results in fewer conversion on common modern systems with support for clock_gettime, pthread_cond_timedwait and ppoll. gettimeofday is declared obsolete by POSIX.1-2008, so it is yet another reason to move away from it. This also appears to result in the reduction of compatibility code required for dealing with inconsistent implementations of "struct timeval".tv_sec In the future, this will also result in fewer conversions for kqueue and pselect if we elect to use them. [ruby-core:85416] [Feature #14452] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/thread_win32.c b/thread_win32.c
index bb330e9..530f6e7 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -271,10 +271,10 @@ rb_w32_Sleep(unsigned long msec)
}
static void
-native_sleep(rb_thread_t *th, struct timeval *tv)
+native_sleep(rb_thread_t *th, struct timespec *ts)
{
- const volatile DWORD msec = (tv) ?
- (DWORD)(tv->tv_sec * 1000 + tv->tv_usec / 1000) : INFINITE;
+ const volatile DWORD msec = (ts) ?
+ (DWORD)(ts->tv_sec * 1000 + ts->tv_nsec / 1000000) : INFINITE;
GVL_UNLOCK_BEGIN();
{