ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/package.html
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/package.html (file contents):
Revision 1.30 by jsr166, Sat Sep 10 22:17:52 2005 UTC vs.
Revision 1.31 by jsr166, Wed Sep 14 22:58:22 2005 UTC

# Line 148 | Line 148 | Chapter 17 of the Java Language Specific
148   writes of shared variables.  The results of a write by one thread are
149   guaranteed to be visible to a read by another thread only if the write
150   operation <i>happens-before</i> the read operation.  The
151 < <tt>synchronized</tt> and <tt>volatile</tt> constructs, as well as the
152 < <tt>Thread.start()</tt> and <tt>Thread.join()</tt> methods, can form
151 > {@code synchronized} and {@code volatile} constructs, as well as the
152 > {@code Thread.start()} and {@code Thread.join()} methods, can form
153   <i>happens-before</i> relationships. In particular:
154  
155   <ul>
156    <li>Each action in a thread <i>happens-before</i> every action in that
157    thread that comes later in the program's order.
158  
159 <  <li>An unlock (<tt>synchronized</tt> block or method exit) of a
160 <  monitor <i>happens-before</i> every subsequent lock (<tt>synchronized</tt>
159 >  <li>An unlock ({@code synchronized} block or method exit) of a
160 >  monitor <i>happens-before</i> every subsequent lock ({@code synchronized}
161    block or method entry) of that same monitor. And because
162    the <i>happens-before</i> relation is transitive, all actions
163    of a thread prior to unlocking <i>happen-before</i> all actions
164    subsequent to any thread locking that monitor.
165  
166 <  <li>A write to a <tt>volatile</tt> field <i>happens-before</i> every
166 >  <li>A write to a {@code volatile} field <i>happens-before</i> every
167    subsequent read of that same field. Writes and reads of
168 <  <tt>volatile</tt> fields have similar memory consistency effects
168 >  {@code volatile} fields have similar memory consistency effects
169    as entering and exiting monitors, but do <em>not</em> entail
170    mutual exclusion locking.
171  
172 <  <li>A call to <tt>start</tt> on a thread <i>happens-before</i> any action in the
172 >  <li>A call to {@code start} on a thread <i>happens-before</i> any action in the
173    started thread.
174  
175    <li>All actions in a thread <i>happen-before</i> any other thread
176 <  successfully returns from a <tt>join</tt> on that thread.
176 >  successfully returns from a {@code join} on that thread.
177  
178   </ul>
179  
180  
181 < The methods of all classes in <tt>java.util.concurrent</tt> and its
181 > The methods of all classes in {@code java.util.concurrent} and its
182   subpackages extend these guarantees to higher-level
183   synchronization. In particular:
184  
185   <ul>
186  
187 <  <li>State changes to any object made prior to placement into any
188 <  concurrent collection <i>happen-before</i> this element is accessed via or
189 <  removed from that collection.
190 <
191 <  <li>State changes to a <tt>Runnable</tt> object made by the
192 <  submitting thread prior to submission to an <tt>Executor</tt>
193 <  <i>happen-before</i> its execution.  Similarly, state changes to a
194 <  <tt>Callable</tt> object made by the submitting thread before being
195 <  submitted to an <tt>ExecutorService</tt> <i>happen-before</i> its
196 <  execution.
197 <
198 <  <li>State changes to a <tt>Future</tt> that
199 <  <i>happen-before</i> it is made available
200 <  <i>happen-before</i> access via <tt>Future.get()</tt>.
187 >  <li>Actions in a thread prior to placing an object into any concurrent
188 >  collection <i>happen-before</i> actions subsequent to the access or
189 >  removal of that element from the collection in another thread.
190 >
191 >  <li>Actions in a thread prior to the submission of a {@code Runnable}
192 >  to an {@code Executor} <i>happen-before</i> its execution begins.
193 >  Similarly for {@code Callables} submitted to an {@code ExecutorService}.
194 >
195 >  <li>Actions taken by the asynchronous computation represented by a
196 >  {@code Future} <i>happen-before</i> actions subsequent to the
197 >  retrieval of the result via {@code Future.get()} in another thread.
198  
199    <li>Actions prior to "releasing" synchronizer methods such as
200 <  <tt>Lock.unlock</tt>, <tt>Semaphore.release</tt>, and
201 <  <tt>CountDownLatch.countDown</tt>
202 <  <i>happen-before</i> actions subsequent to a successful "acquiring" method such as
203 <  <tt>Lock.lock</tt>, <tt>Semaphore.acquire</tt>, <tt>Condition.await</tt>, and
204 <  <tt>CountDownLatch.await</tt> on the same synchronizer object.
200 >  {@code Lock.unlock}, {@code Semaphore.release}, and
201 >  {@code CountDownLatch.countDown} <i>happen-before</i> actions
202 >  subsequent to a successful "acquiring" method such as
203 >  {@code Lock.lock}, {@code Semaphore.acquire},
204 >  {@code Condition.await}, and {@code CountDownLatch.await} on the
205 >  same synchronizer object in another thread.
206  
207    <li>For each pair of threads that successfully exchange objects via
208 <  an <tt>Exchanger</tt>, actions prior to the <tt>exchange()</tt>
208 >  an {@code Exchanger}, actions prior to the {@code exchange()}
209    in each thread <i>happen-before</i> those subsequent to the
210 <  corresponding <tt>exchange()</tt> in the other thread.
210 >  corresponding {@code exchange()} in another thread.
211  
212 <  <li>Actions prior to calling <tt>CyclicBarrier.await</tt>
212 >  <li>Actions prior to calling {@code CyclicBarrier.await}
213    <i>happen-before</i> actions performed by the barrier action, and
214    actions performed by the barrier action <i>happen-before</i> actions
215 <  subsequent to a successful return from the corresponding <tt>await</tt>
215 >  subsequent to a successful return from the corresponding {@code await}
216    in other threads.
217  
218   </ul>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines