From 35e731649da88fda916509eb1cb0a745d772f21c Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 17 May 2000 06:33:50 +0000 Subject: thread problems git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index d39557d2c0..f4a5b72bd3 100644 --- a/eval.c +++ b/eval.c @@ -6736,9 +6736,9 @@ rb_thread_schedule() copy_fds(&readfds, &th->readfds, th->fd); copy_fds(&writefds, &th->writefds, th->fd); copy_fds(&exceptfds, &th->exceptfds, th->fd); - th->fd = 0; if (max < th->fd) max = th->fd; need_select = 1; + th->fd = 0; } if (th->wait_for & WAIT_TIME) { if (th->delay <= now) { @@ -6885,8 +6885,9 @@ rb_thread_fd_writable(fd) curr_thread->status = THREAD_STOPPED; FD_ZERO(&curr_thread->readfds); FD_ZERO(&curr_thread->writefds); - FD_ZERO(&curr_thread->exceptfds); FD_SET(fd, &curr_thread->writefds); + FD_ZERO(&curr_thread->exceptfds); + curr_thread->fd = fd+1; curr_thread->wait_for = WAIT_SELECT; rb_thread_schedule(); } @@ -7011,7 +7012,7 @@ rb_thread_select(max, read, write, except, timeout) if (timeout) { curr_thread->delay = timeofday() + (double)timeout->tv_sec + (double)timeout->tv_usec*1e-6; - curr_thread->wait_for = WAIT_TIME; + curr_thread->wait_for |= WAIT_TIME; } rb_thread_schedule(); if (read) *read = curr_thread->readfds; -- cgit v1.2.3