Thread closing?

@t1 = Thread.new do
b = false
until b == true
sleep 10
puts “you are getting cold!”
end
end

So, that gets called when a play enters a ‘cold’ room. I want to set in
the ‘leave’ event:

@t1.close

or something to that effect, but i get errors when trying to call
@t1.exit… Any thoughts?

Tim M. wrote:

@t1 = Thread.new do
b = false
until b == true
sleep 10
puts “you are getting cold!”
end
end

So, that gets called when a play enters a ‘cold’ room. I want to set in
the ‘leave’ event:

@t1.close

or something to that effect, but i get errors when trying to call
@t1.exit… Any thoughts?

You can call @t1.raise or @t1.kill, however those methods are pretty
scary. I’d do something like polling:
b = false
@t1 = Thread.new { sleep 10 until b == true}
and set b to true elsewhere in the code.
-=R