jruby_threach 0.3.0-java → 0.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +6 -2
  2. data/lib/jruby_threach.rb +3 -4
  3. metadata +3 -3
@@ -59,9 +59,10 @@ You can also use Threach::MultiEnum, the class behind `#mthreach`, by itself, fo
59
59
 
60
60
  me = Threach::MultiEnum.new(
61
61
  [1..10, 'a'..'z', File.open('myfile.txt')], # array of enumerables
62
+ 3, # number of threads. nil => one per enum
62
63
  :each, # enumerator method to use
63
- 10, # size of the internal queue
64
- 3) # number of threads. nil => one per enum
64
+ 10 # size of the internal queue
65
+ )
65
66
  me.each {|item| process_item(item)}
66
67
 
67
68
 
@@ -71,6 +72,9 @@ You can also use Threach::MultiEnum, the class behind `#mthreach`, by itself, fo
71
72
 
72
73
  **Spurious warning** As of this writing, breaking out of a `threach` loop (by calling `break` in the passed block) causes JRuby to print a warning of the form, 'Exception in thread "RubyThread-44: samples.rb:1"org.JRuby.exceptions.JumpException$BreakJump'. Hopefully this can be tracked down and eliminated by the JRuby team.
73
74
 
75
+ ## CHANGES
76
+
77
+ * 0.4.0 Changed signature of Threach::MultiEnum.new to put no. threads up front.
74
78
 
75
79
  ## Contributing to JRuby_threach
76
80
 
@@ -60,13 +60,13 @@ module Threach
60
60
 
61
61
  # Create a new MultiEnum
62
62
  # @param [Enumerable] enumerators A list of enumerators that you wish to act as a single enum
63
+ # @param [Integer, nil] numthreads The number of threads to dedicate to pulling items
63
64
  # @param [Symbol] iterator Which iterator to call against each enum
64
65
  # @param [Integer] size The size of the underlying queue
65
- # @param [Integer, nil] numthreads The number of threads to dedicate to pulling items
66
66
  # off the enumerators and pushing them onto the shared queue. nil or zero implies one for
67
67
  # each enumerator
68
68
  # @return [Threach::MultiEnum] the new multi-enumerator
69
- def initialize enumerators, iterator = :each, size = 5, numthreads=nil
69
+ def initialize enumerators, numthreads=nil, iterator = :each, size = 5
70
70
  @enum = enumerators
71
71
  @iter = iterator
72
72
  @size = size
@@ -139,7 +139,7 @@ module Enumerable
139
139
  # [1..10, 'a'..'z'].mthreach(2,2) {|i| process_item(i)}
140
140
  #
141
141
  def mthreach(pthreads=nil, threads = 0, iterator = :each, &blk)
142
- me = Threach::MultiEnum.new(self, iterator, threads * 3, pthreads)
142
+ me = Threach::MultiEnum.new(self, pthreads, iterator, threads*3)
143
143
  me.send(:threach, threads, iterator, &blk)
144
144
  end
145
145
 
@@ -274,7 +274,6 @@ module Enumerable
274
274
  end
275
275
  end
276
276
 
277
- __END__
278
277
 
279
278
  class DelayedEnum
280
279
  include Enumerable
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jruby_threach
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.4.0
6
6
  platform: java
7
7
  authors:
8
8
  - BillDueber
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-30 00:00:00 -07:00
13
+ date: 2011-07-01 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- hash: -1042269137
105
+ hash: -424975983
106
106
  segments:
107
107
  - 0
108
108
  version: "0"