« Return to Thread: [ruby-core:20999] Supporting Thread.critical=with native threads

[ruby-core:21002] Re: Supporting Thread.critical=with native threads

by Eric Hodel :: Rate this Message:

Reply to Author | View in Thread

On Dec 30, 2008, at 15:00 PM, Shri Borde wrote:
> Thread.critical= is supposed to not schedule any other thread, in  
> addition to guaranteeing that only one thread is ever in the block  
> with Thread.critical==true. This is easier to support with green  
> threads.

This is not true, Thread.critical= does not automatically schedule  
other threads.  The programmer can schedule other threads as they  
desire, however:

$ cat thr.rb
Thread.critical = true

t2 = Thread.start { puts "in other thread" }

puts "t2 finished: #{t2.inspect}"
$ ruby thr.rb
in other thread
t2 finished: #<Thread:0x29324 dead>



 « Return to Thread: [ruby-core:20999] Supporting Thread.critical=with native threads