B
Boris Glawe
Hi,
I'd like to start thousands of threads, each sleeping a random time and printing
a string to the terminal.
How do you stop a thread for a certain time without stopping the whole process?
1000.times{ |i|
Thread.new{
sleep(rand(10)) # this method does not only stop the thread but the whole
thread!!
puts ("hello world says #{i.to_s}")
}
}
thanks and greets
Boris
I'd like to start thousands of threads, each sleeping a random time and printing
a string to the terminal.
How do you stop a thread for a certain time without stopping the whole process?
1000.times{ |i|
Thread.new{
sleep(rand(10)) # this method does not only stop the thread but the whole
thread!!
puts ("hello world says #{i.to_s}")
}
}
thanks and greets
Boris