Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2010-11-11 18:05:03 +0000
committerPawel Piech2010-11-11 18:05:03 +0000
commit8378c53a181ec16d9978a5c7974d16872535aa22 (patch)
treecfe520b6418020901e22028ca4563a8bb6dc6b55 /dsf/org.eclipse.cdt.tests.dsf
parentb0f3b7b7689e2cef4c2b8e85b93e554478708e49 (diff)
downloadorg.eclipse.cdt-8378c53a181ec16d9978a5c7974d16872535aa22.tar.gz
org.eclipse.cdt-8378c53a181ec16d9978a5c7974d16872535aa22.tar.xz
org.eclipse.cdt-8378c53a181ec16d9978a5c7974d16872535aa22.zip
Bug 329488 - DSF ACPM deadlocks
Diffstat (limited to 'dsf/org.eclipse.cdt.tests.dsf')
-rw-r--r--dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java
index c9cd8021ab8..b7092fbbabd 100644
--- a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java
+++ b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/CacheTests.java
@@ -521,6 +521,14 @@ public class CacheTests {
@Test
public void cancelWhilePendingWithoutClientNotificationTest() throws InterruptedException, ExecutionException {
+ final boolean canceledCalled[] = new boolean[] { false };
+
+ fTestCache = new TestCache() {
+ protected synchronized void canceled() {
+ canceledCalled[0] = true;
+ };
+ };
+
// Request data from cache
Query<Integer> q = new Query<Integer>() {
@Override
@@ -550,12 +558,21 @@ public class CacheTests {
q.cancel(true);
assertCacheInvalidAndWithCanceledRM();
+
+ // AbstractCache.canceled() should be called after isCanceled()
+ // discovers that the client has canceled its request. The canceled() method is
+ // called in a separate dispatch cycle, so we have to wait one cycle of the executor
+ // after is canceled is called.
+ fRetrieveRm.isCanceled();
+ fExecutor.submit(new Runnable() { public void run() {} }).get();
+ Assert.assertTrue(canceledCalled[0]);
try {
q.get();
Assert.fail("Expected a cancellation exception");
} catch (CancellationException e) {} // Expected exception;
+
// Completed the retrieve RM
fExecutor.submit(new DsfRunnable() {
public void run() {

Back to the top