utilrb 2.1.0.rc2 → 2.1.0.rc3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9bfb8e1175b1ffa405bea9fc06055b153364249
4
- data.tar.gz: 0ff0ff328a8cdcef8337856285f52c81ef9a5381
3
+ metadata.gz: 6100c171a6de15632948260b64f0a620d7900649
4
+ data.tar.gz: c9134cfae24bccca6e0d9d1ecd5f5e591ff08493
5
5
  SHA512:
6
- metadata.gz: ae7c8b3f0ce2f1d0b61449e90b28694ab0063d6e5015b1404f0b66f9fb698098f71c8abc3438d1e9eadcdf4ff8c4f70d3ca7a3390d67e1a3b50717e3ee884cc5
7
- data.tar.gz: d76cbb7814fc402e8f8c52d807fa0691685fb58e14f1d4706195eba7c59853faa0e3df7cf5cc472f0b323d161882e2dd651b4d65434169c4c37f0b0e06432aba
6
+ metadata.gz: 6dea0d5179e097046ceeba40bcde4be3224281e787e950686aeb6450eec44bf91066ed8b39b08aec8a78b6e8459e56dafff00954a3021053326372cf0effd120
7
+ data.tar.gz: 3b851d311ecddfe1f30ef87f06bf5b71ea3d0d0f3aac4eecb7408868e8b472f8430edc83fadbf9658d2c9614e26bc8f8bbdc9d8ac6dce27b7e996fb5491f688f
data/.travis.yml CHANGED
@@ -1,5 +1,9 @@
1
+ sudo: false
1
2
  language: ruby
2
3
  rvm:
3
4
  - 2.0.0
4
5
  - 2.1.6
5
6
  - 2.2.2
7
+ script:
8
+ - bundle exec rake
9
+ - bundle exec rake test
@@ -7,7 +7,7 @@ class Module
7
7
  if instance_variable_defined?(:@__utilrb_singleton_class)
8
8
  @__utilrb_singleton_class
9
9
  else
10
- @__utilrb_singleton_class = (ancestors.first == self)
10
+ @__utilrb_singleton_class = (ancestors.first != self)
11
11
  end
12
12
  end
13
13
  end
@@ -241,10 +241,10 @@ module Utilrb
241
241
  # @return[Float]
242
242
  def time_elapsed(time = Time.now)
243
243
  #no need to synchronize here
244
- if running?
245
- (time-@started_at).to_f
246
- elsif finished?
244
+ if @stopped_at
247
245
  (@stopped_at-@started_at).to_f
246
+ elsif @started_at
247
+ (time-@started_at).to_f
248
248
  else
249
249
  0
250
250
  end
@@ -361,8 +361,8 @@ module Utilrb
361
361
  @mutex.synchronize do
362
362
  @min = min
363
363
  @max = max || min
364
- count = [@tasks_waiting.size,@max].min
365
- 0.upto(count) do
364
+ count = [@tasks_waiting.size,@max - @spawned].min
365
+ count.times do
366
366
  spawn_thread
367
367
  end
368
368
  end
@@ -373,7 +373,7 @@ module Utilrb
373
373
  #
374
374
  # @return [Fixnum] the number of tasks
375
375
  def backlog
376
- @mutex.synchronize do
376
+ @mutex.synchronize do
377
377
  @tasks_waiting.length
378
378
  end
379
379
  end
@@ -514,12 +514,12 @@ module Utilrb
514
514
 
515
515
  # Shuts down all threads.
516
516
  #
517
- def shutdown()
517
+ def shutdown
518
518
  tasks = nil
519
519
  @mutex.synchronize do
520
520
  @shutdown = true
521
+ @cond.broadcast
521
522
  end
522
- @cond.broadcast
523
523
  end
524
524
 
525
525
 
@@ -527,7 +527,13 @@ module Utilrb
527
527
  # This does not terminate any thread by itself and will block for ever
528
528
  # if shutdown was not called.
529
529
  def join
530
- @workers.first.join until @workers.empty?
530
+ while true
531
+ if w = @mutex.synchronize { @workers.first }
532
+ w.join
533
+ else
534
+ break
535
+ end
536
+ end
531
537
  self
532
538
  end
533
539
 
@@ -1,4 +1,4 @@
1
1
  module Utilrb
2
- VERSION = "2.1.0.rc2"
2
+ VERSION = "2.1.0.rc3"
3
3
  end
4
4
 
@@ -4,7 +4,7 @@ module Utilrb
4
4
  class WeakRef < ::WeakRef
5
5
  def initialize(obj)
6
6
  if obj.kind_of?(::WeakRef)
7
- raise ArgumentError, "cannot create a weakref of a weakref"
7
+ Kernel.raise ::ArgumentError, "cannot create a weakref of a weakref"
8
8
  end
9
9
  super
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utilrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.rc2
4
+ version: 2.1.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-26 00:00:00.000000000 Z
11
+ date: 2015-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facets