View Javadoc

1   // AtomicLongCSImpl.java, created Aug 9, 2003 3:50:36 AM by John Whaley
2   // Copyright (C) 2003 John Whaley
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.ClassLib.Common.sun.misc;
5   
6   /***
7    * AtomicLongCSImpl
8    * 
9    * @author John Whaley
10   * @version $Id: AtomicLongCSImpl.java 1451 2004-03-09 06:27:08Z jwhaley $
11   */
12  abstract class AtomicLongCSImpl {
13      private volatile long value;
14      public boolean attemptUpdate(long a, long b) {
15          // todo: atomic cas8
16          if (value == a) {
17              value = b;
18              return true;
19          } else {
20              return false;
21          }
22      }
23  }