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.79 by jsr166, Sun Jun 5 20:39:02 2016 UTC vs.
Revision 1.80 by dl, Wed Jun 8 19:44:32 2016 UTC

# Line 336 | Line 336 | public class Exchanger<V> {
336              int j = (i << ASHIFT) + ((1 << ASHIFT) - 1);
337              if (j < 0 || j >= alen)
338                  j = alen - 1;
339 <            Node q = (Node)AA.getVolatile(a, j);
339 >            Node q = (Node)AA.getAcquire(a, j);
340              if (q != null && AA.compareAndSet(a, j, q, null)) {
341                  Object v = q.item;                     // release
342                  q.match = item;
# Line 366 | Line 366 | public class Exchanger<V> {
366                                       (--spins & ((SPINS >>> 1) - 1)) == 0)
367                                  Thread.yield();        // two yields per wait
368                          }
369 <                        else if (AA.getVolatile(a, j) != p)
369 >                        else if (AA.getAcquire(a, j) != p)
370                              spins = SPINS;       // releaser hasn't set match yet
371                          else if (!t.isInterrupted() && m == 0 &&
372                                   (!timed ||
373                                    (ns = end - System.nanoTime()) > 0L)) {
374                              p.parked = t;              // minimize window
375 <                            if (AA.getVolatile(a, j) == p) {
375 >                            if (AA.getAcquire(a, j) == p) {
376                                  if (ns == 0L)
377                                      LockSupport.park(this);
378                                  else
# Line 380 | Line 380 | public class Exchanger<V> {
380                              }
381                              p.parked = null;
382                          }
383 <                        else if (AA.getVolatile(a, j) == p &&
383 >                        else if (AA.getAcquire(a, j) == p &&
384                                   AA.compareAndSet(a, j, p, null)) {
385                              if (m != 0)                // try to shrink
386                                  BOUND.compareAndSet(this, b, b + SEQ - 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines