mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
e090c62277
commit
6ebdbb30ad
2 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
Mon Jan 25 23:08:10 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* thread.c (do_select): wrong conditions. [ruby-core:27753]
|
||||
|
||||
Mon Jan 25 22:31:53 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* test/ruby/envutil.rb: use method_defined? instead of
|
||||
|
|
6
thread.c
6
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);
|
||||
|
|
Loading…
Reference in a new issue