[Swift-commit] r7094 - in branches/release-0.94/src/org/griphyn/vdl/karajan: . lib
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sat Sep 21 19:16:43 CDT 2013
Author: hategan
Date: 2013-09-21 19:16:43 -0500 (Sat, 21 Sep 2013)
New Revision: 7094
Modified:
branches/release-0.94/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java
branches/release-0.94/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java
Log:
fixed race condition in self closing loops (bug 1087)
Modified: branches/release-0.94/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java 2013-09-21 23:27:28 UTC (rev 7093)
+++ branches/release-0.94/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java 2013-09-22 00:16:43 UTC (rev 7094)
@@ -129,7 +129,7 @@
}
listeners.add(new ListenerStackPair(target, stack));
WaitingThreadsMonitor.addThread(stack, node);
- if (!node.isClosed()) {
+ if (!node.isClosed() && keys.isEmpty()) {
return;
}
}
Modified: branches/release-0.94/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java 2013-09-21 23:27:28 UTC (rev 7093)
+++ branches/release-0.94/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java 2013-09-22 00:16:43 UTC (rev 7094)
@@ -107,14 +107,16 @@
int available = tc.available();
try {
int j = 0;
- try {
- for (; j < available && i.hasNext(); j++) {
- startIteration(tc, var, i.current(), i.next(), stack);
+ synchronized(tc) {
+ try {
+ for (; j < available && i.hasNext(); j++) {
+ startIteration(tc, var, i.current(), i.next(), stack);
+ }
}
+ finally {
+ tc.add(j);
+ }
}
- finally {
- tc.add(j);
- }
while (i.hasNext()) {
startIteration(tc, var, i.current(), tc.tryIncrement(), stack);
}
@@ -314,11 +316,11 @@
}
}
- public synchronized int available() {
+ public int available() {
return maxThreadCount - crt;
}
- public synchronized void add(int count) {
+ public void add(int count) {
crt += count;
}
More information about the Swift-commit
mailing list