Hi --

On Wed, 20 Feb 2008, Ripta Pasay wrote:

>
>
> On Wed, 20 Feb 2008 05:01:13 +0900, "David A. Black" <dblack / rubypal.com>
> wrote:
>> (That last one had both letters but only one newline.)
>>
>> I'm not quite sure what all of this adds up to, in terms of predicting
>> thread behavior at or near the end of a program. That one can't? :-)
>>
>>
>> David
>>
>> --
>
>
> Was order of execution in Thread ever guaranteed? The output, for instance,
> is different between my two machines, even on the same version of ruby:
>
>    $ ruby -ve 'Thread.new { puts "a" }; puts "b"'
>    ruby 1.9.0 (2008-02-16 revision 3) [i686-linux]
>    b
>
>    $ ruby -ve 'Thread.new { puts "a" }; puts "b"'
>    ruby 1.9.0 (2008-02-16 revision 3) [i686-darwin8.9.1]
>    ba
>
> If I needed to ensure a thread finishes before exiting, I would #join it.

i don't think it was guaranteed but I was seeing patterns of results
in 1.8.6 that were very different (and in some cases less patterned)
than in 1.9. I agree, though: the comparatively predictable behavior
in 1.8 doesn't mean that there's any automatic joining of threads
going on. I was just curious about the differences.


David

-- 
Upcoming Rails training from David A. Black and Ruby Power and Light:
   ADVANCING WITH RAILS, April 14-17 2008, New York City
   CORE RAILS, June 24-27 2008, London (Skills Matter)
See http://www.rubypal.com for details, and stay
tuned for dates in Berlin!