Sha256: e02376f472b50cb032ea2fbb132a8fcb718d113e5ddb4878919370d2dfb3d6d1
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
require 'concurrent/synchronization' # has to be loaded before JRuby extensions require 'concurrent/utility/engine' module Concurrent module Utility # @!visibility private module NativeExtensionLoader @c_ext_loaded ||= false @java_ext_loaded ||= false # @!visibility private def allow_c_extensions? Concurrent.on_cruby? end if Concurrent.on_cruby? && !@c_ext_loaded tries = [ lambda do require 'concurrent/extension' @c_ext_loaded = true end, lambda do # may be a Windows cross-compiled native gem require "concurrent/#{RUBY_VERSION[0..2]}/extension" @c_ext_loaded = true end] tries.each do |try| begin try.call break rescue LoadError next end end end if Concurrent.on_jruby? && !@java_ext_loaded begin require 'concurrent_ruby_ext' @java_ext_loaded = true rescue LoadError # move on with pure-Ruby implementations end end end end # @!visibility private extend Utility::NativeExtensionLoader end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
concurrent-ruby-1.0.0.pre2-java | lib/concurrent/utility/native_extension_loader.rb |
concurrent-ruby-1.0.0.pre2 | lib/concurrent/utility/native_extension_loader.rb |