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.45 by jsr166, Fri Oct 22 05:49:04 2010 UTC vs.
Revision 1.46 by jsr166, Mon Nov 29 20:58:06 2010 UTC

# Line 326 | Line 326 | public class Exchanger<V> {
326              else if (y == null &&                 // Try to occupy
327                       slot.compareAndSet(null, me)) {
328                  if (index == 0)                   // Blocking wait for slot 0
329 <                    return timed? awaitNanos(me, slot, nanos): await(me, slot);
329 >                    return timed ?
330 >                        awaitNanos(me, slot, nanos) :
331 >                        await(me, slot);
332                  Object v = spinWait(me, slot);    // Spin wait for non-0
333                  if (v != CANCEL)
334                      return v;
# Line 587 | Line 589 | public class Exchanger<V> {
589       */
590      public V exchange(V x) throws InterruptedException {
591          if (!Thread.interrupted()) {
592 <            Object v = doExchange(x == null? NULL_ITEM : x, false, 0);
592 >            Object v = doExchange((x == null) ? NULL_ITEM : x, false, 0);
593              if (v == NULL_ITEM)
594                  return null;
595              if (v != CANCEL)
# Line 642 | Line 644 | public class Exchanger<V> {
644      public V exchange(V x, long timeout, TimeUnit unit)
645          throws InterruptedException, TimeoutException {
646          if (!Thread.interrupted()) {
647 <            Object v = doExchange(x == null? NULL_ITEM : x,
647 >            Object v = doExchange((x == null) ? NULL_ITEM : x,
648                                    true, unit.toNanos(timeout));
649              if (v == NULL_ITEM)
650                  return null;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines