Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/hotspot-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ <h3 id="factoring-and-class-design">Factoring and Class Design</h3>
attribute, the change should be done with a "setter" accessor matched to
the simple "getter".</p></li>
</ul>
<h4 id="conventions-for-lock-free-code">Conventions for Lock-free
Code</h4>
<p>Sometimes variables are accessed concurrently without appropriate
synchronization context, such as a held mutex or at a safepoint. In such
cases the variable should be declared <code>volatile</code> and it
should NOT be accessed as a normal C++ lvalue. Rather, access should be
performed via functions from <code>Atomic</code>, such as
<code>Atomic::load</code>, <code>Atomic::store</code>, etc.</p>
<p>This special formulation makes it more clear to maintainers that the
variable is accessed concurrently in a lock-free manner.</p>
<h3 id="source-files">Source Files</h3>
<ul>
<li><p>All source files must have a globally unique basename. The build
Expand Down
11 changes: 11 additions & 0 deletions doc/hotspot-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ lines of code. Name what you must repeat.
change should be done with a "setter" accessor matched to the simple
"getter".

#### Conventions for Lock-free Code

Sometimes variables are accessed concurrently without appropriate synchronization
context, such as a held mutex or at a safepoint. In such cases the variable should
be declared `volatile` and it should NOT be accessed as a normal C++ lvalue. Rather,
access should be performed via functions from `Atomic`, such as `Atomic::load`,
`Atomic::store`, etc.

This special formulation makes it more clear to maintainers that the variable is
accessed concurrently in a lock-free manner.

### Source Files

* All source files must have a globally unique basename. The build
Expand Down