Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Ruby | Thread abort_on_exception function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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 :




# Ruby code for Thread.abort_on_exception() method
  
# declaring Thread 
a = Thread.new { print "a"; Thread.stop; print "c" }
  
# abort_on_exception form
puts "Thread a abort_on_exception() form : #{a.abort_on_exception()}\n\n"

Output :

Thread a abort_on_exception() form : false

Example #2 :




# Ruby code for Thread.abort_on_exception() method
  
# declaring Thread 
a = Thread.new { puts "HI! I am learning to code"}
  
# abort_on_exception form
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
My Personal Notes arrow_drop_up
Last Updated : 09 Dec, 2019
Like Article
Save Article
Similar Reads