Skip to content

Commit fcfae7f

Browse files
comment voaltile threadContext
1 parent e46a38f commit fcfae7f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/com/concurrent_ruby/ext/SynchronizationLibrary.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ private RubyClass defineClass(Ruby runtime, RubyModule namespace, String parentN
8787

8888
// module JRubyAttrVolatile
8989
public static class JRubyAttrVolatile {
90+
91+
// volatile threadContext is used as a memory barrier per the JVM memory model happens-before semantic
92+
// on volatile fields. any volatile field could have been used but using the thread context is an
93+
// attempt to avoid code elimination.
9094
private static volatile ThreadContext threadContext = null;
9195

9296
@JRubyMethod(name = "full_memory_barrier", visibility = Visibility.PRIVATE)

0 commit comments

Comments
 (0)