Sha256: b1e1165b7527b6973f2536431d947ab81a7dad846b6b0c3cc2eff3f56f727ec8

Contents?: true

Size: 967 Bytes

Versions: 8

Compression:

Stored size: 967 Bytes

Contents

# Fibers are hard... let's go shopping!
begin
  require "fiber"
rescue LoadError => ex
  if defined? JRUBY_VERSION
    if RUBY_VERSION < "1.9.2"
      raise LoadError, "Celluloid requires JRuby 1.9 mode. Please pass the --1.9 flag or set JRUBY_OPTS=--1.9"
    end

    # Fibers are broken on JRuby 1.6.5. This works around the issue
    if JRUBY_VERSION[/^1\.6\.5/]
      require "jruby"
      org.jruby.ext.fiber.FiberExtLibrary.new.load(JRuby.runtime, false)
      class org.jruby.ext.fiber::ThreadFiber
        field_accessor :state
      end

      class Fiber
        def alive?
          JRuby.reference(self).state != org.jruby.ext.fiber.ThreadFiberState::FINISHED
        end
      end
    else
      # Just in case subsequent JRuby releases have broken fibers :/
      raise ex
    end
  elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
    raise LoadError, "Celluloid requires Rubinius 1.9 mode. Please pass the -X19 flag."
  else
    raise ex
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
celluloid-0.17.4 lib/celluloid/fiber.rb
celluloid-0.18.0.pre lib/celluloid/fiber.rb
celluloid-0.17.3 lib/celluloid/fiber.rb
celluloid-0.17.2 lib/celluloid/fiber.rb
celluloid-0.17.1.2 lib/celluloid/fiber.rb
celluloid-0.17.1.1 lib/celluloid/fiber.rb
celluloid-0.17.1 lib/celluloid/fiber.rb
celluloid-0.17.0 lib/celluloid/fiber.rb