Hi,

In message "[ruby-talk:10480] Re: Preemptive scheduling?"
    on 01/02/07, Clemens Wyss <wys / helbling.ch> writes:

|>What are you expecting?  On my box th2 seemed to have killed th1.
|
|I tried this on a Linux- and a WinNT-box. Both would not kill th1!

Hmm, using the following code, th1 was killed after 10 recursions.

  if false
    def recursion(n)
      p n
      x = 0
      while 1 do
        x = x + 1
      end
      x
    end
  else
    def recursion(n)
      p n
      if n == 0 then
        1
      else
        (n * recursion(n-1)) **2 
      end
    end
  end

  th1 = Thread.new {
    print recursion (50), "\n"
  }
  p th1
  th1.priority = -5
  th2 = Thread.new {
    sleep .1
    p "killing"
    th1.kill()
    p Thread.list
  }
  th2.priority = 4
  th1.join()

I don't know what is the difference.  Probably my stupid mistake again.

|>Do not use mere numbers for conditionals.  It may cause surprising
|>effect inherited from Perl.  I will disable this feature someday.

|Matz, I don't get you here, sorry. Could you be more precise?

I was saying about your

  while 1
  end

in your sample.  An integer literal in the conditional is treated
specially (compared to $. variable), which I consider it bad now.
I was stupid.

							matz.