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:
6
6
7
7
* fixed documentation and README links
8
8
* fix Set for TruffleRuby and Rubinius
9
+ * use properly supported TruffleRuby APIs
9
10
10
11
concurrent-ruby-edge:
11
12
Original file line number Diff line number Diff line change 2
2
require 'concurrent/utility/engine'
3
3
require 'concurrent/atomic_reference/numeric_cas_wrapper'
4
4
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
+
5
12
module Concurrent
6
13
7
14
# Define update methods that use direct paths
@@ -155,8 +162,10 @@ class JavaAtomicReference
155
162
end
156
163
JavaAtomicReference
157
164
when Concurrent . on_truffleruby?
158
- class TruffleRubyAtomicReference < Truffle ::AtomicReference
165
+ class TruffleRubyAtomicReference < TruffleRuby ::AtomicReference
159
166
include AtomicDirectUpdate
167
+ alias_method :value , :get
168
+ alias_method :value= , :set
160
169
alias_method :compare_and_swap , :compare_and_set
161
170
alias_method :swap , :get_and_set
162
171
end
Original file line number Diff line number Diff line change 1
1
require 'concurrent/thread_safe/util'
2
2
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
+
3
12
module Concurrent
4
13
module ThreadSafe
5
14
module Util
@@ -44,8 +53,7 @@ def self.make_synchronized_on_truffleruby(klass)
44
53
klass . superclass . instance_methods ( false ) . each do |method |
45
54
klass . class_eval <<-RUBY , __FILE__ , __LINE__ + 1
46
55
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) }
49
57
end
50
58
RUBY
51
59
end
You can’t perform that action at this time.
0 commit comments