1 # -*- encoding: binary -*-
3 # {NeverBlock}[www.espace.com.eg/neverblock/] library that combines
4 # the EventMachine library with Ruby Fibers. This includes use of
5 # Thread-based Fibers under Ruby 1.8. It currently does NOT support
6 # a streaming "rack.input" but is compatible with everything else
7 # EventMachine supports.
9 # === :pool_size vs worker_connections
11 # In your Rainbows! config block, you may specify a Fiber pool size
12 # to limit your application concurrency (without using Rainbows::AppPool)
13 # independently of worker_connections.
16 # use :NeverBlock, :pool_size => 50
17 # worker_connections 100
20 module Rainbows::NeverBlock
22 extend Rainbows::PoolSize
24 # same pool size NB core itself uses
25 def self.setup # :nodoc:
27 Rainbows::O[:backend] ||= :EventMachine # no Cool.io support, yet
28 Rainbows.const_get(Rainbows::O[:backend])
29 require "never_block" # require EM first since we need a higher version
32 def self.extended(klass)
33 klass.extend(Rainbows.const_get(Rainbows::O[:backend])) # EventMachine
34 klass.extend(Rainbows::NeverBlock::Core)
39 require 'rainbows/never_block/core'