Module: Fibre
- Extended by:
- Fibre
- Included in:
- Fibre
- Defined in:
- lib/fibre/fiber_pool.rb,
lib/fibre.rb,
lib/fibre/mock.rb,
lib/fibre/scope.rb,
lib/fibre/version.rb,
lib/fibre/fiber_error.rb,
lib/fibre/rack/fiber_pool.rb
Overview
Defined Under Namespace
Modules: Rack, Synchrony Classes: FiberError, FiberPool, Mock, Scope
Constant Summary collapse
- DEFAULT_POOL_SIZE =
50
- DEFAULT_POOL_QUEUE_SIZE =
1000
- FIBER_POOL_THREADED =
'__fiber_pool'
- VERSION =
'1.0.2'
Instance Attribute Summary collapse
-
#root ⇒ Object
Establish the root fiber.
Instance Method Summary collapse
- #init_pool(*a) ⇒ Object
- #make_pool(pool_size: DEFAULT_POOL_SIZE, pool_queue_size: DEFAULT_POOL_QUEUE_SIZE) ⇒ Object
-
#pool ⇒ Object
Auto-initialize at first call and each thread has own fiber pool.
- #reset ⇒ Object
Instance Attribute Details
Instance Method Details
#init_pool(*a) ⇒ Object
26 27 28 |
# File 'lib/fibre.rb', line 26 def init_pool(*a) Thread.current[FIBER_POOL_THREADED] = make_pool(*a) end |
#make_pool(pool_size: DEFAULT_POOL_SIZE, pool_queue_size: DEFAULT_POOL_QUEUE_SIZE) ⇒ Object
40 41 42 |
# File 'lib/fibre.rb', line 40 def make_pool(pool_size: DEFAULT_POOL_SIZE, pool_queue_size: DEFAULT_POOL_QUEUE_SIZE) FiberPool.new(pool_size: pool_size, pool_queue_size: pool_queue_size) end |
#pool ⇒ Object
Auto-initialize at first call and each thread has own fiber pool
31 32 33 |
# File 'lib/fibre.rb', line 31 def pool Thread.current[FIBER_POOL_THREADED] ||= make_pool end |
#reset ⇒ Object
35 36 37 38 |
# File 'lib/fibre.rb', line 35 def reset Thread.current[FIBER_POOL_THREADED] = nil pool end |