threading 0.0.1
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 +7 -0
- data/README.md +0 -0
- data/lib/pool.rb +19 -0
- data/lib/threading.rb +1 -0
- data/threading.gemspec +13 -0
- metadata +47 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 86fafc5c20ea1819eedb3fcd6e31b5b19d6ff3cd
|
|
4
|
+
data.tar.gz: ac7e61b0d7ce6238157b254c6155515df257140c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ad13e170f7b1b9ac35912d3c79b66839e9d1a4b1a70c8aae0ba1f9449d94dc786080e7fc58a40f9e48e0a58bb459e969ffbd2faed9e53ba663f23ca1c636c5cd
|
|
7
|
+
data.tar.gz: 44b7a877db0c76ad9deb1f20732c03a0f2d456312c98c96d9ff87000682bb7307f3820a5a2a8f178f9bca1dc9454e4977bc2bd69cb22fc06310eabe4184f06e9
|
data/README.md
ADDED
|
File without changes
|
data/lib/pool.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class Pool
|
|
2
|
+
def initialize(options)
|
|
3
|
+
@min_threads = options[:threads]
|
|
4
|
+
@queue = Queue.new
|
|
5
|
+
@threads = []
|
|
6
|
+
@min_threads.times do |i|
|
|
7
|
+
@threads << Thread.new {
|
|
8
|
+
while true
|
|
9
|
+
block = @queue.pop
|
|
10
|
+
block.call
|
|
11
|
+
end
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def <<(block)
|
|
17
|
+
@queue << block
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/threading.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require File.expand_path('pool', __FILE__)
|
data/threading.gemspec
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = 'threading'
|
|
3
|
+
s.version = '0.0.1'
|
|
4
|
+
s.date = '2014-10-09'
|
|
5
|
+
s.summary = "Tools to concurrency in Ruby"
|
|
6
|
+
s.description = "Some tools to make concurrency in Ruby, like thread pools"
|
|
7
|
+
s.authors = ["Hugo Abonizio"]
|
|
8
|
+
s.email = 'hugo_abonizio@hotmail.com'
|
|
9
|
+
s.files = %w{README.md threading.gemspec}
|
|
10
|
+
s.files += Dir.glob("lib/**/*.rb")
|
|
11
|
+
s.homepage = 'https://github.com/hugoabonizio/threading'
|
|
12
|
+
s.license = 'MIT'
|
|
13
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: threading
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Hugo Abonizio
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Some tools to make concurrency in Ruby, like thread pools
|
|
14
|
+
email: hugo_abonizio@hotmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- README.md
|
|
20
|
+
- lib/pool.rb
|
|
21
|
+
- lib/threading.rb
|
|
22
|
+
- threading.gemspec
|
|
23
|
+
homepage: https://github.com/hugoabonizio/threading
|
|
24
|
+
licenses:
|
|
25
|
+
- MIT
|
|
26
|
+
metadata: {}
|
|
27
|
+
post_install_message:
|
|
28
|
+
rdoc_options: []
|
|
29
|
+
require_paths:
|
|
30
|
+
- lib
|
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: '0'
|
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
requirements: []
|
|
42
|
+
rubyforge_project:
|
|
43
|
+
rubygems_version: 2.2.2
|
|
44
|
+
signing_key:
|
|
45
|
+
specification_version: 4
|
|
46
|
+
summary: Tools to concurrency in Ruby
|
|
47
|
+
test_files: []
|