File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
lib/concurrent-ruby/concurrent Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change
1
+ module Concurrent
2
+
3
+ # @!visibility private
4
+ module Collection
5
+
6
+ # @!visibility private
7
+ class TruffleRubyMapBackend < TruffleRuby ::ConcurrentMap
8
+ def initialize ( options = nil )
9
+ options ||= { }
10
+ super ( initial_capacity : options [ :initial_capacity ] , load_factor : options [ :load_factor ] )
11
+ end
12
+ end
13
+ end
14
+ end
Original file line number Diff line number Diff line change @@ -16,8 +16,13 @@ module Collection
16
16
require 'concurrent/collection/map/mri_map_backend'
17
17
MriMapBackend
18
18
when Concurrent . on_rbx? || Concurrent . on_truffleruby?
19
- require 'concurrent/collection/map/atomic_reference_map_backend'
20
- AtomicReferenceMapBackend
19
+ if defined? ( ::TruffleRuby ::ConcurrentMap )
20
+ require 'concurrent/collection/map/truffleruby_map_backend'
21
+ TruffleRubyMapBackend
22
+ else
23
+ require 'concurrent/collection/map/atomic_reference_map_backend'
24
+ AtomicReferenceMapBackend
25
+ end
21
26
else
22
27
warn 'Concurrent::Map: unsupported Ruby engine, using a fully synchronized Concurrent::Map implementation'
23
28
require 'concurrent/collection/map/synchronized_map_backend'
You can’t perform that action at this time.
0 commit comments