summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-09-25 14:21:25 +0000
committerRich Hickey <richhickey@gmail.com>2006-09-25 14:21:25 +0000
commit3a21d8fa903baed26643ac212626dbc17d26f859 (patch)
tree0325f5f23795f4517473603af28a10f616dc9361
parent7608103759042de92448c70cc4dc9cbabc38f44b (diff)
made rest fully synched
-rw-r--r--src/cli/runtime/EnumeratorSeq.cs58
1 files changed, 28 insertions, 30 deletions
diff --git a/src/cli/runtime/EnumeratorSeq.cs b/src/cli/runtime/EnumeratorSeq.cs
index ef844864..cd42d42a 100644
--- a/src/cli/runtime/EnumeratorSeq.cs
+++ b/src/cli/runtime/EnumeratorSeq.cs
@@ -13,37 +13,35 @@ using System.Collections;
namespace clojure.lang
{
-public class EnumeratorSeq : ASeq{
-IEnumerator e;
-volatile ISeq _rest;
+ public class EnumeratorSeq : ASeq
+ {
+ IEnumerator e;
+ ISeq _rest;
-public static EnumeratorSeq create(IEnumerator e){
- if(e.MoveNext())
- return new EnumeratorSeq(e);
- return null;
-}
+ public static EnumeratorSeq create(IEnumerator e) {
+ if (e.MoveNext())
+ return new EnumeratorSeq(e);
+ return null;
+ }
-EnumeratorSeq(IEnumerator e){
- this.e = e;
- this._rest = this;
-}
+ EnumeratorSeq(IEnumerator e) {
+ this.e = e;
+ this._rest = this;
+ }
-override public Object first() {
- return e.Current;
-}
+ override public Object first() {
+ return e.Current;
+ }
-override public ISeq rest() {
- if(_rest == this)
- {
- lock(this){
- if(_rest == this)
- {
- _rest = create(e);
- }
- }
- }
- return _rest;
-}
-}
-
-}
+ override public ISeq rest() {
+ lock (this)
+ {
+ if (_rest == this)
+ {
+ _rest = create(e);
+ }
+ return _rest;
+ }
+ }
+ }
+} \ No newline at end of file