My guess is that since you're not joining the thread to the main
thread, it just terminates after the main thread exits. Try this:

a =3D 0
thread =3D Thread.new do
  while true
    puts "#{a+=3D1}"
  end
end
thread.join



Alex

On Wed, Aug 19, 2009 at 9:51 AM, Im still<quietstill / gmail.com> wrote:
> hi
> when im running a code like this
>
> =A0 =A0 a =3D 0
> =A0 =A0 =A0Thread.start{
> =A0 =A0 =A0while true
> =A0 =A0 =A0 =A0puts "#{a+=3D1}"
> =A0 =A0 =A0end
> =A0 =A0 =A0}
>
> This will be terminated automatically but wont keep on looping as expecte=
d.
> And by my test, the running result will always terminated while a =3D 41.=
means
> after putting "41" it stops.
>
> Im doing this in windows vista. I dont know if its OS related issue or no=
t.
> or maybe im doing wrong ? anyone can tell me?
>