File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ concurrent-ruby:
66
77* fixed documentation and README links
88* fix Set for TruffleRuby and Rubinius
9+ * use properly supported TruffleRuby APIs
910
1011concurrent-ruby-edge:
1112
Original file line number Diff line number Diff line change 22require 'concurrent/utility/engine'
33require 'concurrent/atomic_reference/numeric_cas_wrapper'
44
5+ # Shim for TruffleRuby::AtomicReference
6+ if Concurrent . on_truffleruby? && !defined? ( TruffleRuby ::AtomicReference )
7+ module TruffleRuby
8+ AtomicReference = Truffle ::AtomicReference
9+ end
10+ end
11+
512module Concurrent
613
714 # Define update methods that use direct paths
@@ -155,8 +162,10 @@ class JavaAtomicReference
155162 end
156163 JavaAtomicReference
157164 when Concurrent . on_truffleruby?
158- class TruffleRubyAtomicReference < Truffle ::AtomicReference
165+ class TruffleRubyAtomicReference < TruffleRuby ::AtomicReference
159166 include AtomicDirectUpdate
167+ alias_method :value , :get
168+ alias_method :value= , :set
160169 alias_method :compare_and_swap , :compare_and_set
161170 alias_method :swap , :get_and_set
162171 end
Original file line number Diff line number Diff line change 11require 'concurrent/thread_safe/util'
22
3+ # Shim for TruffleRuby.synchronized
4+ if Concurrent . on_truffleruby? && !TruffleRuby . respond_to? ( :synchronized )
5+ module TruffleRuby
6+ def self . synchronized ( object , &block )
7+ Truffle ::System . synchronized ( object , &block )
8+ end
9+ end
10+ end
11+
312module Concurrent
413 module ThreadSafe
514 module Util
@@ -44,8 +53,7 @@ def self.make_synchronized_on_truffleruby(klass)
4453 klass . superclass . instance_methods ( false ) . each do |method |
4554 klass . class_eval <<-RUBY , __FILE__ , __LINE__ + 1
4655 def #{ method } (*args, &block)
47- # TODO (pitr-ch 01-Jul-2018): don't use internal TruffleRuby APIs
48- Truffle::System.synchronized(self) { super(*args, &block) }
56+ TruffleRuby.synchronized(self) { super(*args, &block) }
4957 end
5058 RUBY
5159 end
You can’t perform that action at this time.
0 commit comments