View Single Post
  #7 (permalink)  
Old 11-06-2007, 12:25 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Cool Re: MultiThreading in Ruby

I also tried as follows,

Code:
a=Thread.new do
#same as 1st thread above
end

b=Thread.new do
#same as 2nd thread above
end
What I've tried with this code is using the Thread.pass function which passes control to the other thread once the current thread has finished one loop. (Both threads havely while loops which loop until (i) input file has finished reading (ii) There are less than 10 objects in queue to compare with) When I now execute the program it runs but are there is no output. (The program has some output when I run the 2 threads normally in series) Is there something missing code to run the 2 threads in parallel? Sorry if the answer seems obvious, as I've never actually done ruby/multithreading.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Reply With Quote