summaryrefslogtreecommitdiff
path: root/src/cli/runtime/ThreadLocalData.cs
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-06-10 19:29:20 +0000
committerRich Hickey <richhickey@gmail.com>2006-06-10 19:29:20 +0000
commitac65dac6b044e965d244e78ee5f7d49a62440c92 (patch)
treede2166d549ba01a21151bddd68ecf01e7adc5d25 /src/cli/runtime/ThreadLocalData.cs
parentdc5642e9d61e6a6099d3b9690ff3e40415d532c7 (diff)
interim checkin, modified TLD - Var broken
Diffstat (limited to 'src/cli/runtime/ThreadLocalData.cs')
-rw-r--r--src/cli/runtime/ThreadLocalData.cs75
1 files changed, 22 insertions, 53 deletions
diff --git a/src/cli/runtime/ThreadLocalData.cs b/src/cli/runtime/ThreadLocalData.cs
index 3b57c632..f48f3cc4 100644
--- a/src/cli/runtime/ThreadLocalData.cs
+++ b/src/cli/runtime/ThreadLocalData.cs
@@ -15,60 +15,29 @@ using System.Collections.Specialized;
namespace org.clojure.runtime
{
-public class ThreadLocalData{
-
-public const int MULTIPLE_VALUES_LIMIT = 20;
-public int mvCount = 0;
-public Object[] mvArray = new Object[MULTIPLE_VALUES_LIMIT];
-
-internal HybridDictionary dynamicBindings = new HybridDictionary();
-
-internal Transaction transaction;
+public class ThreadLocalData{
+
+[ThreadStatic]
+private static Transaction transaction;
+[ThreadStatic]
+private static Object[] values;
+
+static public Object[] getValues(){
+ return values;
+}
+
+static public void setValues(Object[] vals) {
+ values = vals;
+}
+
+static public Transaction getTransaction() {
+ return transaction;
+}
+
+static public void setTransaction(Transaction t){
+ transaction = t;
+}
-public Transaction getTransaction() {
- if(transaction == null)
- throw new Exception("No active transaction");
- return transaction;
-}
-
-public ThreadLocalData(HybridDictionary dynamicBindings)
- {
- this.mvCount = 0;
- this.mvArray = new Object[MULTIPLE_VALUES_LIMIT];
- this.dynamicBindings = dynamicBindings;
- }
-
-public ThreadLocalData():
- this(new HybridDictionary())
- {
- }
-
-public static ThreadLocalData get()
- {
- if(tld == null)
- tld = new ThreadLocalData();
- return tld;
- }
-
-/*
-note this is not the same semantics as InheritableThreadLocal - aargh
-might need to make Java side non-inheritable
-*/
-[ThreadStatic]
- static ThreadLocalData tld;
- /* was this in Java
-static InheritableThreadLocal tld = new InheritableThreadLocal(){
- protected Object childValue(Object object)
- {
- return new ThreadLocalData((HybridDictionary) ((ThreadLocalData) object).dynamicBindings.clone());
- }
-
- protected Object initialValue()
- {
- return new ThreadLocalData();
- }
-};
-*/
}
}