rdispatch 0.0.1b → 0.0.1c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdispatch.rb +4 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 924f0a84c2230e40ec2781e5b4249940938aad58
4
- data.tar.gz: e00ca32942ea868210c2cf83a688deb2acd7de5f
3
+ metadata.gz: d19c222f89b918b3d212d4e21e2a4695d189d0bd
4
+ data.tar.gz: 6ec309ba7a165a65d2b6dec8fcd7cf9d0ac6b142
5
5
  SHA512:
6
- metadata.gz: 7a7a56c01f3df4823defa205c4d729ce4689fc84be1cf7c1c3579d62cb294095ce2c97388bf77211b238b16594dd64178d9a64728e1c10f221265ac4c8a5e49e
7
- data.tar.gz: 75de049ea2035917c45878c4d280644dc534977e88fe9dccfbae00a8ee950a32a3407b347ec00997cd958ab847aba387921cf0bdb2d78699f888822e2930115d
6
+ metadata.gz: 541a70db80ebd5638c06838ba50c5b132564c781231b1b6e43642a119458d3d8185baa45c588ed603ebdc96465bc2378f0b00eb22e2f2b8f5ae8769ab058c3e8
7
+ data.tar.gz: 2017c22d7bd51764b540d6044d32768731fe7e4ff0c9ff5d3b62f4a496f7ca5240ae0811bb6563b8648c80505cd6df23509965dbc729ffa9b4a4d20aff63687a
data/lib/rdispatch.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class RDispatch
2
2
 
3
3
  def initialize
4
- @tasks = []
4
+ tasks = []
5
5
  end
6
6
 
7
7
  def create_task(callback, data)
@@ -12,24 +12,22 @@ class RDispatch
12
12
  split_data = data.each_slice((data.size/avail_threads.to_f).round).to_a
13
13
  split_data.each do |data_array|
14
14
  # create tasks, each with 1/n of data, where n is number of cpu cores
15
- @tasks << proc { callback.call(data_array) }
15
+ tasks << proc { callback.call(data_array) }
16
16
  end
17
17
  end
18
18
 
19
19
  def run!
20
20
  # run tasks, each in its own thread
21
21
  threads = []
22
- @tasks.each do |t|
22
+ tasks.each do |t|
23
23
  threads << Thread.new do
24
24
  puts "spawning thread"
25
25
  t.call
26
26
  end
27
27
  end
28
28
  threads.each(&:join)
29
- @tasks = []
29
+ tasks = []
30
30
  end
31
31
 
32
- private
33
- @tasks = []
34
32
  end
35
33
  require 'rdispatch/sys'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdispatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1b
4
+ version: 0.0.1c
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valeriy Antonov