From: Eric Hodel Date: 2007-09-10T04:08:20+09:00 Subject: Re: Threading in ruby is retarded .....?~! On Sep 1, 2007, at 12:00, Sal Syed wrote: > I'm running the latest version an Ruby and the way threads work makes > absolutely no sense to me... > > I have the simplest use of threads: > [code] > Thread.new do > while true > puts "Enter command" > if gets.chomp=='exit' > break; > > end > puts 'Ended service' > end > > Thread.new do > while service != nil > server.start > end end > > $user[:drbserver]=DistributedSearch.new($user,$database) > service=DRb.start_service("druby://localhost:#{$config[:drbport]}", > $user[:drbserver]) > DRb.thread.join > [/code] > > When I run this DRb does NOT start until after I type in exit! Why > does > a new thread block the main thread wtf?????? I'm guessing this is not > normal and has something to do with either DRb or Webrick. Isn't > there a > way that these two would just run their own threads...? It makes it > useless to me if I can't run both in the same program Are you using windows? It is broken, not ruby. Don't use gets in the main thread. -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars