From: Grant Schoep Date: 2012-12-30T10:38:00+09:00 Subject: Thread.start(variables) do question So I have been looking at some code I inherited. I see two examples of thread use in this. Wondering what the difference is. I've made up two examples that show this, wondering what the difference is, and why to use one or the other. ---Example 1----------------------------------------------------------- obj1 = SomeObject.new() obj2 = SomeOtherObject.new() obj3 = "helloworld" Thread.start(obj1, obj2, myString) do |thing1, thing2, thing3| #use the variables named thing1, thing2, thing3. end ----------------------------------------------------------------------- And then this way... ---Example 2----------------------------------------------------------- obj1 = SomeObject.new() obj2 = SomeOtherObject.new() obj3 = "helloworld" Thread.start() do #use the objects named obj1, obj2, obj3 end ----------------------------------------------------------------------- So, What is the reason for doing Example 1 versus Example 2. The 2nd example seems simpler in my book. My guess is it has something to do with how the objects may be used outside the thread? -- Posted via http://www.ruby-forum.com/.