From: Kazuhiro NISHIYAMA Date: 2001-12-27T00:24:22+09:00 Subject: [ruby-dev:15556] TCPSocket#open で Errno::EALREADY 西山和広です。 2001-11-28の変更が原因で、TCPSocket#openでErrno::EALREADYに なる場合があります。 とりあえず下につけたようにバックパッチをあてて発生しなくなるのを 確認しました。 -- |ZnZ(ゼット エヌ ゼット) |西山和広(Kazuhiro NISHIYAMA) Index: eval.c =================================================================== RCS file: /src/ruby/eval.c,v retrieving revision 1.137.2.85 diff -u -r1.137.2.85 eval.c --- eval.c 2001/12/20 18:18:19 1.137.2.85 +++ eval.c 2001/12/26 14:28:40 @@ -7505,7 +7505,6 @@ double delay, now; /* OK */ int n, max; int need_select = 0; - int select_timeout = 0; rb_thread_pending = 0; if (curr_thread == curr_thread->next @@ -7549,9 +7548,6 @@ copy_fds(&exceptfds, &th->exceptfds, th->fd); if (max < th->fd) max = th->fd; need_select = 1; - if (th->wait_for & WAIT_TIME) { - select_timeout = 1; - } th->select_value = 0; } if (th->wait_for & WAIT_TIME) { @@ -7613,21 +7609,6 @@ } END_FOREACH_FROM(curr, th); } - if (select_timeout && n == 0) { - if (now < 0.0) now = timeofday(); - FOREACH_THREAD_FROM(curr, th) { - if ((th->wait_for & (WAIT_SELECT|WAIT_TIME)) && th->delay <= now) { - th->status = THREAD_RUNNABLE; - th->wait_for = 0; - th->select_value = 0; - found = 1; - intersect_fds(&readfds, &th->readfds, max); - intersect_fds(&writefds, &th->writefds, max); - intersect_fds(&exceptfds, &th->exceptfds, max); - } - } - END_FOREACH_FROM(curr, th); - } if (n > 0) { now = -1.0; /* Some descriptors are ready. @@ -7851,7 +7832,7 @@ case ERESTART: #endif if (timeout) { - double d = limit - timeofday(); + double d = timeofday() - limit; tv.tv_sec = (unsigned int)d; tv.tv_usec = (long)((d-(double)tv.tv_sec)*1e6);