Hello !

Mike Houghton wrote:
> In my ignorance I expected the supplied block not to be executed in 
> initialize
> and to be executed only in the start method. Please would someone 
> explain where
> I'm going wrong and how to correct it.

  First reflex, before posting ;-):

ri Thread.new:

------------------------------------------------------------ Thread::new
     Thread.new([arg]*) {|args| block }   => thread
------------------------------------------------------------------------
     Creates and runs a new thread to execute the instructions given in
     block. Any arguments passed to Thread::new are passed into the
     block.

        x = Thread.new { sleep 0.1; print "x"; print "y"; print "z" }
        a = Thread.new { print "a"; print "b"; sleep 0.2; print "c" }
        x.join # Let the threads finish before
        a.join # main thread exits...

     produces:

        abxyzc

  So you see, initialize does run the thread. You might want to write an
independent class that would create the thread in the start function.

  Ruby comes with an extensive documentation, at least for standard
classes. I know ri isn't that fast, but faster than any reply here ;-)...

  Welcome to Ruby, and enjoy !

	Vince

-- 
Vincent Fourmond, PhD student
http://vincent.fourmond.neuf.fr/