Sha256: 818cfeca6b94d6b941dbe795b90f09acb5ff9bc9636c112e57934bff33cc4361

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require 'ffi-rzmq'
require 'multi_json'
require 'tnetstring'
require 'thread'

# Allows you to easily interact with Mongrel2 webserver from
# your ruby code.
# @api public
module M2R
  class << self

    # Sets ZMQ context used by M2R to create sockets
    # @param [ZMQ::Context] value Context to by used by M2R
    # @see #zmq_context
    # @api public
    attr_writer :zmq_context

    # Gets (or sets if not existing) ZMQ context used by M2R
    # to create sockets.
    #
    # @note This method is thread-safe
    #   but it uses Thread.exclusive to achive that.
    #   However it is unlikely that it affects the performance as you probably
    #   do not create more than a dozen of sockets in your code.
    #
    # @param [Fixnum] zmq_io_threads Size of the ZMQ thread pool to handle I/O operations.
    #   The rule of thumb is to make it equal to the number gigabits per second
    #   that the application will produce.
    #
    # @return [ZMQ::Context]
    # @see #zmq_context=
    # @api public
    def zmq_context(zmq_io_threads = 1)
      Thread.exclusive do
        @zmq_context ||= ZMQ::Context.new(zmq_io_threads)
      end
    end
  end
end

# @deprecated: Use M2R instead
#   Namespace used in the past in 0.0.* gem releases
Mongrel2 = M2R

require 'm2r/request'
require 'm2r/response'
require 'm2r/reply'
require 'm2r/connection'
require 'm2r/connection_factory'
require 'm2r/handler'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
m2r-2.0.2 lib/m2r.rb
m2r-2.0.1 lib/m2r.rb
m2r-2.0.0 lib/m2r.rb