Skip to content
Browse files

fixes commute after set

Signed-off-by: Rich Hickey <richhickey@gmail.com>
  • Loading branch information...
1 parent c045881 commit 833f9f368d2274766aa4699195b3fba3f9e4e8f0 @cgrand cgrand committed with richhickey Aug 3, 2009
Showing with 5 additions and 7 deletions.
  1. +5 −7 src/jvm/clojure/lang/LockingTransaction.java
View
12 src/jvm/clojure/lang/LockingTransaction.java
@@ -240,6 +240,8 @@ Object run(Callable fn) throws Exception{
for(Map.Entry<Ref, ArrayList<CFn>> e : commutes.entrySet())
{
Ref ref = e.getKey();
+ if(sets.contains(ref)) continue;
+
ref.lock.writeLock().lock();
locked.add(ref);
Info refinfo = ref.tinfo;
@@ -249,20 +251,16 @@ Object run(Callable fn) throws Exception{
throw retryex;
}
Object val = ref.tvals == null ? null : ref.tvals.val;
- if(!sets.contains(ref))
- vals.put(ref, val);
+ vals.put(ref, val);
for(CFn f : e.getValue())
{
vals.put(ref, f.fn.applyTo(RT.cons(vals.get(ref), f.args)));
}
}
for(Ref ref : sets)
{
- if(!commutes.containsKey(ref))
- {
- ref.lock.writeLock().lock();
- locked.add(ref);
- }
+ ref.lock.writeLock().lock();
+ locked.add(ref);
}
//validate and enqueue notifications

0 comments on commit 833f9f3

Please sign in to comment.
Something went wrong with that request. Please try again.