Ruby | Thread abort_on_exception function
Last Updated :
09 Dec, 2019
Thread#abort_on_exception() : abort_on_exception() is a Thread class method which returns the status of the thread-local “abort on exception” condition for this “thr”.
Syntax: Thread.abort_on_exception()
Parameter: Thread values
Return: The status of the thread-local “abort on exception”
Default – False
Example #1 :
a = Thread . new { print "a" ; Thread .stop; print "c" }
puts "Thread a abort_on_exception() form : #{a.abort_on_exception()}\n\n"
|
Output :
Thread a abort_on_exception() form : false
Example #2 :
a = Thread . new { puts "HI! I am learning to code" }
puts "Thread a abort_on_exception() form : #{a.abort_on_exception()}\n\n"
|
Output :
Thread a abort_on_exception() form : false
=> nilHI! I am learning to code
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...