rb_thread_pool 0.0.2 → 0.0.3
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 +4 -4
- data/lib/core/rb_elastic.rb +2 -1
- data/lib/rb_thread_pool.rb +0 -22
- 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: c5cdff2f03ee913d871bf4e5d178eea28af04f96
|
4
|
+
data.tar.gz: c8d531fa61087d6838db3fdee69546b8e9b93186
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b307d6e11e84db15561c00f4c7a923f26774247adf3e8d5a2f622c2242e79b5ff34f138cc05785c532f74c0014594bec74d1cfb29f57c9e2dca8ac4728e43561
|
7
|
+
data.tar.gz: fbf4dcef7de7a095633f2881108188644d27e7544d6a83f2fa99cfffcd737502bcd49f41b14266888e3381710698ead80c1ba99e25a15fe058d44ee8ad8831f7
|
data/lib/core/rb_elastic.rb
CHANGED
@@ -19,12 +19,13 @@ module RBThreadPool
|
|
19
19
|
queue = @queue
|
20
20
|
while @condition
|
21
21
|
begin
|
22
|
+
Thread.current.exit if queue.empty?
|
22
23
|
task = queue.pop(true)
|
23
|
-
Thread.current.exit if task.nil?
|
24
24
|
task.call
|
25
25
|
rescue Interrupt
|
26
26
|
task.call unless task.nil?
|
27
27
|
Thread.current.exit
|
28
|
+
rescue
|
28
29
|
rescue => ex
|
29
30
|
raise Exception, ex.message if @log.nil?
|
30
31
|
@log.error("ElasticThread:: msg: #{ex.message}, backtrace: #{ex.backtrace}")
|
data/lib/rb_thread_pool.rb
CHANGED
@@ -34,27 +34,5 @@ require 'core/base'
|
|
34
34
|
#
|
35
35
|
# p pool.daemon_th_inspect
|
36
36
|
#
|
37
|
-
# # add with block
|
38
|
-
# pool.add do
|
39
|
-
# sleep(2)
|
40
|
-
# puts "i'm the first adder"
|
41
|
-
# end
|
42
|
-
#
|
43
|
-
#
|
44
|
-
# # add with proc
|
45
|
-
# blk = proc {puts "i'm the second adder"}
|
46
|
-
# pool << blk
|
47
|
-
#
|
48
|
-
#
|
49
|
-
# # pushb is alias method for add
|
50
|
-
# 20.times do |idx|
|
51
|
-
# pool.pushb do
|
52
|
-
# sleep(0.5)
|
53
|
-
# puts "i'm in times at index #{idx}"
|
54
|
-
# end
|
55
|
-
# end
|
56
|
-
#
|
57
|
-
#
|
58
|
-
# p pool.daemon_th_inspect
|
59
37
|
#
|
60
38
|
# sleep
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb_thread_pool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick An
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A rb thread pool
|
14
14
|
email: 1198847374@qq.com
|