From 6ebdbb30add7acc3edc49bc910c4931e5125fb10 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 25 Jan 2010 14:09:46 +0000 Subject: [PATCH] * thread.c (do_select): wrong conditions. [ruby-core:27753] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ thread.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5074ded4b..5edf2c0a5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jan 25 23:08:10 2010 NAKAMURA Usaku + + * thread.c (do_select): wrong conditions. [ruby-core:27753] + Mon Jan 25 22:31:53 2010 Yusuke Endoh * test/ruby/envutil.rb: use method_defined? instead of diff --git a/thread.c b/thread.c index bd0803539a..c56f3b72dc 100644 --- a/thread.c +++ b/thread.c @@ -2457,7 +2457,7 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except, wait_100ms.tv_usec = 100 * 1000; /* 100 ms */ do { - wait = (timeout == 0 || cmp_tv(&wait_100ms, timeout) > 0) ? &wait_100ms : timeout; + wait = (timeout == 0 || cmp_tv(&wait_100ms, timeout) < 0) ? &wait_100ms : timeout; BLOCKING_REGION({ do { result = select(n, read, write, except, wait); @@ -2467,16 +2467,16 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except, if (read) *read = orig_read; if (write) *write = orig_write; if (except) *except = orig_except; - wait = &wait_100ms; if (timeout) { struct timeval elapsed; gettimeofday(&elapsed, NULL); subtract_tv(&elapsed, &start_time); + gettimeofday(&start_time, NULL); if (!subtract_tv(timeout, &elapsed)) { finish = 1; break; } - if (cmp_tv(&wait_100ms, timeout) < 0) wait = timeout; + if (cmp_tv(&wait_100ms, timeout) > 0) wait = timeout; } } while (__th->interrupt_flag == 0); }, 0, 0);