What is the safe_level : safe_level « Threads « Ruby






What is the safe_level


t1 = Thread.new { $SAFE = 1; sleep 5 }
t2 = Thread.new { $SAFE = 3; sleep 5 }
sleep 1
lev0 = Thread.main.safe_level    # 0
lev1 = t1.safe_level             # 1
lev2 = t2.safe_level             # 3

 








Related examples in the same category