fibre 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db1d530ae64a23f807393667c363468029793a08
4
- data.tar.gz: 1e3beff3e7217e7d0342ed286a26d8582bd2f83e
3
+ metadata.gz: f970c043f98fcc2801ddfe967e4f34b3530dd4df
4
+ data.tar.gz: 719b4c185bf0840bdf36b404d8240fa9e49ef543
5
5
  SHA512:
6
- metadata.gz: f9aeeb9131aa92c7e6b9dc635ff9febc58e8aef886efb7f4b193f2fcab9af56307cec183c516d5ebfc26cac33f5a9d39eac3cd029fecc723f85bee22a0230cff
7
- data.tar.gz: 900961fecc9cf43a44e09bec69d66d9dc4eae5293765e51bdd314aa4e89ef99a601acc44ab48f5ca923a2ec96431d38c9701da942f51c3a93f9f92b84843343e
6
+ metadata.gz: a4f2515c15206146d75828a88b42f1b66c7aa623b850e2f53c65cb722c071f48253ce1a2c85661ad70d3915bce290e8cb79a7a463c9eee46633cf4d7e6243b59
7
+ data.tar.gz: 89eb35e13e9208a8b8ab4656b11478b64ecd308fd7b7af66af9a5224d6665997c709b5fa7942955d1b04c16ea1a2c7b1fe03f2cbca11bbd856749fb9c1a050e7
@@ -23,8 +23,8 @@ module Fibre
23
23
  DEFAULT_POOL_QUEUE_SIZE = 1000
24
24
  FIBER_POOL_THREADED = '__fiber_pool'
25
25
 
26
- def make_pool(pool_size: DEFAULT_POOL_SIZE, pool_queue_size: DEFAULT_POOL_QUEUE_SIZE)
27
- FiberPool.new(pool_size: pool_size, pool_queue_size: pool_queue_size)
26
+ def init_pool(*a)
27
+ Thread.current[FIBER_POOL_THREADED] = make_pool(*a)
28
28
  end
29
29
 
30
30
  # Auto-initialize at first call and each thread has own fiber pool
@@ -36,4 +36,8 @@ module Fibre
36
36
  Thread.current[FIBER_POOL_THREADED] = nil
37
37
  pool
38
38
  end
39
+
40
+ def make_pool(pool_size: DEFAULT_POOL_SIZE, pool_queue_size: DEFAULT_POOL_QUEUE_SIZE)
41
+ FiberPool.new(pool_size: pool_size, pool_queue_size: pool_queue_size)
42
+ end
39
43
  end
@@ -1,3 +1,3 @@
1
1
  module Fibre
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -13,6 +13,12 @@ describe Fibre do
13
13
  expect(Fibre.pool.pool_queue_size).to be(1000)
14
14
  end
15
15
 
16
+ it "initializes global pool" do
17
+ Fibre.init_pool(pool_size: 10, pool_queue_size: 900)
18
+ expect(Fibre.pool.pool_size).to be(10)
19
+ expect(Fibre.pool.pool_queue_size).to be(900)
20
+ end
21
+
16
22
  it "has the root fiber" do
17
23
  expect(Fibre.root).to equal(Fiber.current)
18
24
  expect(Fiber.current.root?).to be true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fibre
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - inre