なかだです。

 なんか古いパッチが出て来たんで出してみます。

 WAIT_SELECTしたときの戻り値に、他のスレッドの要求した分まで含
まれいてるような気がします。Thread.currentの要求したものだけを
返すようにするならたぶんこんな感じ。

	* eval.c (intersect_fds): counts intersecting fds.

	* eval.c (rb_thread_schedule): only fds requested by
	  each thread count as select_value.


Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.199 diff -u -2 -p -r1.199 eval.c --- eval.c 2001/08/14 08:13:26 1.199 +++ eval.c 2001/08/22 10:58:59 @@ -7474,10 +7474,10 @@ match_fds(dst, src, max) } -static void +static int intersect_fds(src, dst, max) fd_set *src, *dst; int max; { - int i; + int i, n = 0; for (i=0; i<=max; i++) { @@ -7486,4 +7486,5 @@ intersect_fds(src, dst, max) /* Wake up only one thread per fd. */ FD_CLR(i, src); + ++n; } else { @@ -7492,4 +7493,5 @@ intersect_fds(src, dst, max) } } + return n; } @@ -7647,7 +7649,7 @@ rb_thread_schedule() th->status = THREAD_RUNNABLE; th->wait_for = 0; - intersect_fds(&readfds, &th->readfds, max); - intersect_fds(&writefds, &th->writefds, max); - intersect_fds(&exceptfds, &th->exceptfds, max); + n = intersect_fds(&readfds, &th->readfds, max) + + intersect_fds(&writefds, &th->writefds, max) + + intersect_fds(&exceptfds, &th->exceptfds, max); th->select_value = n; found = 1;
-- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦