From: Brian Candler Date: 2009-12-15T19:18:58+09:00 Subject: Re: Multithread TCPServer not dequeueing packets David Rodriguez wrote: > while (session_sock = @csock.accept) > worker_thread = Thread.new { > handle_connection(session_sock)} > end That code isn't thread-safe, because the outer loop could change session_sock before the worker thread has used it. while session_sock = @csock.accept Thread.new(session_sock) do |conn| handle_connection(conn) end end -- Posted via http://www.ruby-forum.com/.