summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ThreadSafeProgressMonitorTest.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ThreadSafeProgressMonitor.java5
2 files changed, 3 insertions, 4 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ThreadSafeProgressMonitorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ThreadSafeProgressMonitorTest.java
index b44970e358..2845f8acfe 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ThreadSafeProgressMonitorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ThreadSafeProgressMonitorTest.java
@@ -104,9 +104,11 @@ public class ThreadSafeProgressMonitorTest {
assertEquals(42, mock.value);
pm.update(1);
+ pm.pollForUpdates();
assertEquals(43, mock.value);
pm.update(2);
+ pm.pollForUpdates();
assertEquals(45, mock.value);
pm.endTask();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ThreadSafeProgressMonitor.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ThreadSafeProgressMonitor.java
index 9e8e256b01..ff85f9b8fd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ThreadSafeProgressMonitor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ThreadSafeProgressMonitor.java
@@ -157,10 +157,7 @@ public class ThreadSafeProgressMonitor implements ProgressMonitor {
}
public void update(int completed) {
- int old = pendingUpdates.getAndAdd(completed);
- if (isMainThread())
- doUpdates();
- else if (old == 0)
+ if (0 == pendingUpdates.getAndAdd(completed))
process.release();
}