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

Comparing jsr166/src/main/java/util/concurrent/Exchanger.java (file contents):
Revision 1.28 by dl, Wed Sep 14 23:48:52 2005 UTC vs.
Revision 1.29 by jsr166, Fri Sep 16 03:59:07 2005 UTC

# Line 18 | Line 18 | import java.util.Random;
18   * and receives its partner's object on return.
19   *
20   * <p><b>Sample Usage:</b>
21 < * Here are the highlights of a class that uses an <tt>Exchanger</tt> to
22 < * swap buffers between threads so that the thread filling the
23 < * buffer gets a freshly
24 < * emptied one when it needs it, handing off the filled one to
25 < * the thread emptying the buffer.
26 < * <pre>
21 > * Here are the highlights of a class that uses an {@code Exchanger}
22 > * to swap buffers between threads so that the thread filling the
23 > * buffer gets a freshly emptied one when it needs it, handing off the
24 > * filled one to the thread emptying the buffer.
25 > * <pre>{@code
26   * class FillAndEmpty {
27 < *   Exchanger&lt;DataBuffer&gt; exchanger = new Exchanger();
27 > *   Exchanger<DataBuffer> exchanger = new Exchanger<DataBuffer>();
28   *   DataBuffer initialEmptyBuffer = ... a made-up type
29   *   DataBuffer initialFullBuffer = ...
30   *
# Line 60 | Line 59 | import java.util.Random;
59   *     new Thread(new EmptyingLoop()).start();
60   *   }
61   * }
62 < * </pre>
62 > * }</pre>
63   *
64   * <p>Memory consistency effects: For each pair of threads that
65   * successfully exchange objects via an {@code Exchanger}, actions

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines