Ruby | Thread backtrace function
Last Updated :
09 Dec, 2019
Thread#backtrace() : backtrace() is a Thread class method which returns the current backtrace of the target thread.
Syntax: Thread.backtrace()
Parameter: Thread values
Return: the current backtrace of the target thread.
Example #1 :
a = Thread . new { print "a" ; Thread .stop; print "c" }
puts "Thread a backtrace() form : #{a.backtrace()}\n\n"
|
Output :
Thread a backtrace() form : []
Example #2 :
a = Thread . new { puts "HI! I am learning to code" }
puts "Thread a backtrace() form : #{a.backtrace()}\n\n"
|
Output :
Thread a backtrace() form : []
HI! I am learning to code
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...