I
Im still
[Note: parts of this message were removed to make it a legal post.]
Hi all
I'm trying to run two thread at one time in a program.
And one of them will receive user inputting msgs by gets().
another one will do something else at the same time.
they don't communicate each other.
like this :
thread_a = Thread.new{
loop do
puts "please enter blah blah"
msg = gets
#do something
end
}
thread_a.join
thread_b = Thread.new{
loop do
#do other things maybe puts "im running im running
......"
end
}
thread_b.join
but when thread_a runs gets waiting for user input, whole program will be
paused waiting for this, I mean thread_b will not working.
How can I handle this ?
Do I have to do this by running multi process?
Hi all
I'm trying to run two thread at one time in a program.
And one of them will receive user inputting msgs by gets().
another one will do something else at the same time.
they don't communicate each other.
like this :
thread_a = Thread.new{
loop do
puts "please enter blah blah"
msg = gets
#do something
end
}
thread_a.join
thread_b = Thread.new{
loop do
#do other things maybe puts "im running im running
......"
end
}
thread_b.join
but when thread_a runs gets waiting for user input, whole program will be
paused waiting for this, I mean thread_b will not working.
How can I handle this ?
Do I have to do this by running multi process?