lib/zmachine.rb in zmachine-0.1.0 vs lib/zmachine.rb in zmachine-0.1.1

- old
+ new

@@ -3,27 +3,27 @@ require 'zmachine/connection' require 'zmachine/deferrable' require 'zmachine/reactor' require 'zmachine/timers' -java_import java.lang.ThreadLocal module ZMachine class ConnectionError < RuntimeError; end class ConnectionNotBound < RuntimeError; end class UnknownTimerFired < RuntimeError; end class Unsupported < RuntimeError; end + class << self + attr_accessor :logger + attr_accessor :debug + end + def self.reactor - @reactor ||= ThreadLocal.new - @reactor.set(Reactor.new) unless @reactor.get - @reactor.get + Thread.current[:reactor] ||= Reactor.new end def self.context - @context ||= ThreadLocal.new - @context.set(ZContext.new) unless @context.get - @context.get + Thread.current[:context] ||= ZContext.new end class << self extend Forwardable def_delegator :reactor, :add_shutdown_hook