Open In App

Ruby | Thread abort_on_exception= function

Last Updated : 09 Dec, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

Thread#abort_on_exception=() : abort_on_exception=() is a Thread class method which sets the raised exception to true or false

Syntax: Thread.abort_on_exception=()

Parameter: Thread values

Return: sets the raised exception to true or 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=true}\n\n"


Output :

Thread a abort_on_exception=() form : true

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=false}\n\n"


Output :

Thread a abort_on_exception=() form : false

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads