diff options
| author | Rich Hickey <richhickey@gmail.com> | 2006-05-31 17:00:54 +0000 |
|---|---|---|
| committer | Rich Hickey <richhickey@gmail.com> | 2006-05-31 17:00:54 +0000 |
| commit | 57162d9fc2d5f78518b20aa49d4843d9de2c1b3e (patch) | |
| tree | 4015a692b2840a1cb3dd45ec602b69d7a2d0d482 /src/cli/runtime/TRef.cs | |
| parent | 06bfce30df5fb0967138b19b46d9c435ff780a5e (diff) | |
port of STM
Diffstat (limited to 'src/cli/runtime/TRef.cs')
| -rw-r--r-- | src/cli/runtime/TRef.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cli/runtime/TRef.cs b/src/cli/runtime/TRef.cs new file mode 100644 index 00000000..e8edcc85 --- /dev/null +++ b/src/cli/runtime/TRef.cs @@ -0,0 +1,32 @@ +/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich May 30, 2006 */
+
+using System;
+using System.Threading;
+
+namespace org.clojure.runtime
+{
+
+public class TRef : TVal, IComparable{
+static int nextSeq = 0;
+
+readonly int lockSeq;
+
+public TRef() {
+ this.lockSeq = Interlocked.Increment(ref nextSeq);
+}
+
+public int CompareTo(Object o){
+ return lockSeq - ((TRef) o).lockSeq;
+}
+}
+}
|
