utilrb 2.1.0.rc2 → 2.1.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/lib/utilrb/module/singleton_class_p.rb +1 -1
- data/lib/utilrb/thread_pool.rb +15 -9
- data/lib/utilrb/version.rb +1 -1
- data/lib/utilrb/weakref.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6100c171a6de15632948260b64f0a620d7900649
|
4
|
+
data.tar.gz: c9134cfae24bccca6e0d9d1ecd5f5e591ff08493
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dea0d5179e097046ceeba40bcde4be3224281e787e950686aeb6450eec44bf91066ed8b39b08aec8a78b6e8459e56dafff00954a3021053326372cf0effd120
|
7
|
+
data.tar.gz: 3b851d311ecddfe1f30ef87f06bf5b71ea3d0d0f3aac4eecb7408868e8b472f8430edc83fadbf9658d2c9614e26bc8f8bbdc9d8ac6dce27b7e996fb5491f688f
|
data/.travis.yml
CHANGED
data/lib/utilrb/thread_pool.rb
CHANGED
@@ -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
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
|
data/lib/utilrb/version.rb
CHANGED
data/lib/utilrb/weakref.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|