Ruby | Thread backtrace function
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 :
# Ruby code for Thread.backtrace() method # declaring Thread a = Thread.new { print "a"; Thread.stop; print "c" } # backtrace form puts "Thread a backtrace() form : #{a.backtrace()}\n\n" |
chevron_right
filter_none
Output :
Thread a backtrace() form : []
Example #2 :
# Ruby code for Thread.backtrace() method # declaring Thread a = Thread.new { puts "HI! I am learning to code"} # backtrace form puts "Thread a backtrace() form : #{a.backtrace()}\n\n" |
chevron_right
filter_none
Output :
Thread a backtrace() form : [] HI! I am learning to code
Recommended Posts:
- Ruby | Thread abort_on_exception= function
- Ruby | Thread abort_on_exception function
- Ruby | Thread alive? function
- Ruby | Thread terminate() function
- Ruby | Thread backtrace_locations() function
- Ruby | Thread add_trace_func function
- Ruby | Thread exit() function
- Ruby | Thread kill() function
- Ruby | Thread group() function
- Ruby | Thread Life Cycle & Its States
- Ruby | Thread Class-Public Class Methods
- Ruby | pop() function
- Ruby | Set add? function
- Ruby | at() function
- Ruby | Time now() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



