J
Jon Handler
I'm pretty new to ruby and this is one of those areas where I can't
quite seem to turn my head inside out as the language requires
I have a log file that I want to process in parts, with multiple threads
working from the same file, each one getting a line at a time and doing
something with it.
I'd like something like
1. Open the file
2. Create 5 threads
Each thread should read a line of the file and process it, but no 2
threads should get the same line.
What I have looks like
open (ARGV.flags.log) do |logfile|
logfile.each do |line|
blah blah blah...
end
end
but that's inside out! How do I rubify this code?
Thanks,
Jon
quite seem to turn my head inside out as the language requires
I have a log file that I want to process in parts, with multiple threads
working from the same file, each one getting a line at a time and doing
something with it.
I'd like something like
1. Open the file
2. Create 5 threads
Each thread should read a line of the file and process it, but no 2
threads should get the same line.
What I have looks like
open (ARGV.flags.log) do |logfile|
logfile.each do |line|
blah blah blah...
end
end
but that's inside out! How do I rubify this code?
Thanks,
Jon