How do you know it hangs up in the sleep statement?  The "Thread.critical =
true" staement looks a might bit suspicious to me.

-----Original Message-----
From: dave / thomases.com [mailto:dave / thomases.com]On Behalf Of Dave
Thomas
Sent: Wednesday, December 19, 2001 9:39 PM
To: ruby-talk ML
Subject: [ruby-talk:29071] Re: A Ruby programmer walked into a bar and
ordered a Ruby-Thread


"Mark Hahn" <mchahn / facelink.com> writes:

> In this situation, correct behaviour if for the higher priority thread to
> run all the time and the lower one to never run.  At any moment whichever
> requesting thread has higher priority should be running.

For example:

      Thread.current.priority = 10
      c1 =  0
      a = Thread.new { Thread.stop; loop { c1 += 1 }}
      a.priority = Thread.current.priority - 2      # a lower priority
      a.wakeup
      sleep 1
      Thread.critical = true
      p c1

Unfortunately, under Linux, it reports a count, as it does with the
MSWin32 Ruby.  Under Cygwin on my box, it loops forever, with the main
thread sitting in the sleep.

Threads should work, and with consistent cross-platform semantics. The
fact that they don't is a bug that as a community we need to address.



Dave