Skip to content

Commit 22e01bf

Browse files
committed
More bug fixes, working on getting ioc_macros_test to run
1 parent 7319f6a commit 22e01bf

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/main/clojure/clojure/core/async/impl/channels.clj

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
;;; We need to walk two pointers, current node and next node. Check the current node, delete if required.
4040
;;; Then move the pointers.
4141

42-
(deftype ManyToManyChannel [^|LinkedList`1| takes ^|LinkedList`1| puts ^|Queue`1| buf closed ^clojure.core.async.impl.mutex.Lock mutex add!]
42+
(deftype ManyToManyChannel [^|LinkedList`1| takes ^|LinkedList`1| puts ^|Queue`1| buf closed ^clojure.core.async.impl.mutex.ILock mutex add!]
4343
MMC
4444
(cleanup
4545
[_]
@@ -87,12 +87,13 @@
8787
(let [iter (.GetEnumerator puts)]
8888
(when (.MoveNext iter)
8989
(loop [[^ILock putter] (.Current iter)] ;;; ^Lock
90-
(let [put-cb (and (impl/active? putter) (impl/commit putter))]
91-
(.unlock putter)
92-
(when put-cb
93-
(dispatch/run (fn [] (put-cb true))))
94-
(when (.MoveNext iter)
95-
(recur (.Current iter)))))))
90+
(.lock putter)
91+
(let [put-cb (and (impl/active? putter) (impl/commit putter))]
92+
(.unlock putter)
93+
(when put-cb
94+
(dispatch/run (fn [] (put-cb true))))
95+
(when (.MoveNext iter)
96+
(recur (.Current iter)))))))
9697
(.Clear puts) ;;; .clear
9798
(impl/close! this))
9899

@@ -135,7 +136,7 @@
135136
[take-cbs (loop [takers []
136137
curr-node (.First takes)]
137138
(if (and curr-node (pos? (count buf)))
138-
(let [^ILock taker curr-node ;;; ^Lock
139+
(let [^ILock taker (.Value curr-node) ;;; ^Lock
139140
next-node (.Next curr-node)]
140141
(.lock taker)
141142
(let [ret (and (impl/active? taker) (impl/commit taker))]
@@ -181,8 +182,8 @@
181182
;;; (when (.hasNext iter)
182183
;;; (recur (.next iter)))))))]
183184
[[put-cb take-cb] (when (.First takes)
184-
(loop [^ILock taker (.First takes) ;;; ^Lock
185-
curr-node (.First takes)]
185+
(loop [curr-node (.First takes)
186+
^ILock taker (.Value curr-node)] ;;; ^Lock
186187
(if (< (impl/lock-id handler) (impl/lock-id taker))
187188
(do (.lock handler) (.lock taker))
188189
(do (.lock taker) (.lock handler)))
@@ -196,7 +197,7 @@
196197
ret)
197198
(let [next-node (.Next curr-node)]
198199
(when next-node
199-
(recur next-node next-node)))))))]
200+
(recur next-node (.Value next-node))))))))]
200201

201202
(if (and put-cb take-cb)
202203
(do

src/test/clojure/clojure/core/async/ioc_macros_test.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
v (try (runner
307307
(try
308308
(try
309-
(throw (InvalidOperationException. 42)) ;;; AssertionError
309+
(throw (InvalidOperationException. "42")) ;;; AssertionError + stringify 42
310310
(finally (swap! a inc)))
311311
(finally (swap! a inc))))
312312
(catch InvalidOperationException ex ex))] ;;; AssertionError
@@ -316,7 +316,7 @@
316316
v (try (runner
317317
(try
318318
(try
319-
(throw (InvalidOperationException. 42)) ;;; AssertionError
319+
(throw (InvalidOperationException. "42")) ;;; AssertionError + stringify 42
320320
(catch Exception ex (throw ex)) ;;; Throwable
321321
(finally (swap! a inc)))
322322
(catch Exception ex (throw ex)) ;;; Throwable
@@ -328,7 +328,7 @@
328328
v (try (runner
329329
(try
330330
(try
331-
(throw (InvalidOperationException. (pause 42))) ;;; AssertionError
331+
(throw (InvalidOperationException. (pause "42"))) ;;; AssertionError + stringify 42
332332
(catch Exception ex (pause (throw ex))) ;;; Throwable
333333
(finally (pause (swap! a inc))))
334334
(catch Exception ex (pause (throw ex))) ;;; Throwable

0 commit comments

Comments
 (0)