On Mon, 13 Mar 2006 17:33:30 +0100, Robert Klemme wrote:

> Hm, but why then isn't it caught by a clause "rescue Exception => e"?

For example in this program, no exception is caught:

require "thread"

m1 = Mutex.new
m2 = Mutex.new

begin

p "begin"
t1 = Thread.new do 
	m1.lock; 
	sleep rand ; 
	begin
		m2.lock 
	rescue ThreadError => e;
		print "Rescuing t1"
	end
end

t2 = Thread.new do 
	m2.lock; 
	sleep rand ; 
	begin
		m1.lock 
	rescue ThreadError => e;
		print "Rescuing t2"
	end
end

p "joining..."
t1.join
t2.join

rescue ThreadError => e;
	print "Rescuing..."
end
-- 
USB Priests for only 10$