File tree Expand file tree Collapse file tree 2 files changed +59
-3
lines changed
Expand file tree Collapse file tree 2 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 1+ require 'concurrent/synchronization/abstract_object' # for JRuby
2+ require 'concurrent/utility/engine'
3+
4+ module Concurrent
5+ module Utility
6+
7+ module NativeExtensionLoader
8+
9+ @c_ext_loaded ||= false
10+ @java_ext_loaded ||= false
11+
12+ # @!visibility private
13+ def allow_c_extensions?
14+ Concurrent . on_cruby?
15+ end
16+
17+ if Concurrent . on_cruby? && !@c_ext_loaded
18+ tries = [
19+ lambda do
20+ require 'concurrent/extension'
21+ @c_ext_loaded = true
22+ end ,
23+ lambda do
24+ # may be a Windows cross-compiled native gem
25+ require "concurrent/#{ RUBY_VERSION [ 0 ..2 ] } /extension"
26+ @c_ext_loaded = true
27+ end ,
28+ lambda do
29+ warn 'Performance on MRI may be improved with the concurrent-ruby-ext gem. Please see http://concurrent-ruby.com'
30+ end ]
31+
32+ tries . each do |try |
33+ begin
34+ try . call
35+ break
36+ rescue LoadError
37+ next
38+ end
39+ end
40+ end
41+
42+ if Concurrent . on_jruby? && !@java_ext_loaded
43+ begin
44+ require 'concurrent_ruby_ext'
45+ @java_ext_loaded = true
46+ rescue LoadError
47+ warn 'Performance on JRuby may be improved by installing the pre-compiled Java extensions. Please see http://concurrent-ruby.com'
48+ end
49+ end
50+ end
51+ end
52+
53+ extend Utility ::NativeExtensionLoader
54+ end
Original file line number Diff line number Diff line change @@ -2,9 +2,11 @@ module Concurrent
22
33 describe Configuration , notravis : true do
44
5- before ( :each ) do
6- # redundant - done in spec_helper.rb
7- # done here again for explicitness
5+ before ( :all ) do
6+ reset_gem_configuration
7+ end
8+
9+ after ( :each ) do
810 reset_gem_configuration
911 end
1012
You can’t perform that action at this time.
0 commit comments