Skip to content

Instantly share code, notes, and snippets.

@peteonrails
Created July 25, 2008 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peteonrails/2526 to your computer and use it in GitHub Desktop.
Save peteonrails/2526 to your computer and use it in GitHub Desktop.
require "threaded_collections"
threadcount = 2
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
tps = ThreadedCollectionProcessor.new(arr)
tps.process(2) { |thread_id, item| puts "Thread #{thread_id} processed item: #{item}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment