Sha256: 36bfd2710697932038f782b1830e8fda5a34be92fdaed2a0ea43b8889930b117

Contents?: true

Size: 798 Bytes

Versions: 8

Compression:

Stored size: 798 Bytes

Contents

require 'tribe'
require 'eventmachine'

require 'tribe_em/version'
require 'tribe_em/actor_proxy'
require 'tribe_em/connection'
require 'tribe_em/dedicated_connection'
require 'tribe_em/tcp_server'

module Tribe
  module EM
    def self.start
      @em_thread = Thread.new do
        ::EM.run do
          ::EM.kqueue = true if ::EM.kqueue?
          ::EM.epoll = true if ::EM.epoll?

          ::EM.error_handler do |e|
            puts "EXCEPTION: #{e.message}\n#{e.backtrace.join("\n")}--"
          end
        end
      end

      return nil
    end

    def self.stop
      ::EM.stop_event_loop
      @em_thread.join if @em_thread
      @em_thread = nil

      return nil
    end

    def self.running?
      return ::EM.reactor_running?
    end
  end
end

# Force EM to run.
Tribe::EM.start

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tribe_em-0.4.0 lib/tribe_em.rb
tribe_em-0.3.0 lib/tribe_em.rb
tribe_em-0.2.0 lib/tribe_em.rb
tribe_em-0.1.0 lib/tribe_em.rb
tribe_em-0.0.6 lib/tribe_em.rb
tribe_em-0.0.5 lib/tribe_em.rb
tribe_em-0.0.4 lib/tribe_em.rb
tribe_em-0.0.3 lib/tribe_em.rb