تابع النسخة abort_on_exception= الخاص بالصنف Thread في روبي
عند إعطائه القيمة true، إذا تم إيقاف هذه المهمة الفرعية بواسطة استثناء، فسيطلق ذلك الاستثناء مجددا في المهمة الفرعية الرئيسية. ويُعيد الحالة الجديدة.
انظر أيضا صفحة abort_on_exception.
يوجد أيضًا تابع نسخة (instance method) لتعيين هذا الخيار لمهمة فرعية معينة، راجع الصفحة abort_on_exception=.
البنية العامة
abort_on_exception= boolean→ true or false
القيمة المُعادة
تعاد قيمة منطقية.
أمثلة
مثال على استخدام التعبير abort_on_exception=:
Thread.abort_on_exception = true
t1 = Thread.new do
puts "In new thread"
raise "Exception from thread"
end
sleep(1)
puts "not reached"
الناتج:
In new thread
prog.rb:4: Exception from thread (RuntimeError)
from prog.rb:2:in `initialize'
from prog.rb:2:in `new'
from prog.rb:2
انظر أيضا
- التابع
abort_on_exception: يُعيد التابعabort_on_exceptionحالة الشرط "abort on exception".