Ruby program to create a simple thread

bookmark

# Thread method
def ThreadFun()
    puts "Thread executed";
end

# Create a thread
t = Thread.new{ThreadFun()};

# Join created thread.
t.join();

puts "Program finished";

 


Output:

Thread executed
Program finished