File tree 3 files changed +34
-7
lines changed
3 files changed +34
-7
lines changed Original file line number Diff line number Diff line change 2231
2231
the value that was swapped in."
2232
2232
{:added " 1.0"
2233
2233
:static true }
2234
- ([^clojure.lang.Atom atom f] (.swap atom f))
2235
- ([^clojure.lang.Atom atom f x] (.swap atom f x))
2236
- ([^clojure.lang.Atom atom f x y] (.swap atom f x y))
2237
- ([^clojure.lang.Atom atom f x y & args] (.swap atom f x y args)))
2234
+ ([^clojure.lang.IAtom atom f] (.swap atom f))
2235
+ ([^clojure.lang.IAtom atom f x] (.swap atom f x))
2236
+ ([^clojure.lang.IAtom atom f x y] (.swap atom f x y))
2237
+ ([^clojure.lang.IAtom atom f x y & args] (.swap atom f x y args)))
2238
2238
2239
2239
(defn compare-and-set!
2240
2240
" Atomically sets the value of atom to newval if and only if the
2241
2241
current value of the atom is identical to oldval. Returns true if
2242
2242
set happened, else false"
2243
2243
{:added " 1.0"
2244
2244
:static true }
2245
- [^clojure.lang.Atom atom oldval newval] (.compareAndSet atom oldval newval))
2245
+ [^clojure.lang.IAtom atom oldval newval] (.compareAndSet atom oldval newval))
2246
2246
2247
2247
(defn reset!
2248
2248
" Sets the value of atom to newval without regard for the
2249
2249
current value. Returns newval."
2250
2250
{:added " 1.0"
2251
2251
:static true }
2252
- [^clojure.lang.Atom atom newval] (.reset atom newval))
2252
+ [^clojure.lang.IAtom atom newval] (.reset atom newval))
2253
2253
2254
2254
(defn set-validator!
2255
2255
" Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a
Original file line number Diff line number Diff line change 14
14
15
15
import java .util .concurrent .atomic .AtomicReference ;
16
16
17
- final public class Atom extends ARef {
17
+ final public class Atom extends ARef implements IAtom {
18
18
final AtomicReference state ;
19
19
20
20
public Atom (Object state ){
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Rich Hickey. All rights reserved.
3
+ * The use and distribution terms for this software are covered by the
4
+ * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5
+ * which can be found in the file epl-v10.html at the root of this distribution.
6
+ * By using this software in any fashion, you are agreeing to be bound by
7
+ * the terms of this license.
8
+ * You must not remove this notice, or any other, from this software.
9
+ **/
10
+
11
+ /* rich Aug 2, 2009 */
12
+
13
+ package clojure .lang ;
14
+
15
+ public interface IAtom {
16
+ Object swap (IFn f );
17
+
18
+ Object swap (IFn f , Object arg );
19
+
20
+ Object swap (IFn f , Object arg1 , Object arg2 );
21
+
22
+ Object swap (IFn f , Object x , Object y , ISeq args );
23
+
24
+ boolean compareAndSet (Object oldv , Object newv );
25
+
26
+ Object reset (Object newval );
27
+ }
You can’t perform that action at this time.
0 commit comments