Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLeo Ufimtsev2017-12-15 10:33:03 -0500
committerLeo Ufimtsev2017-12-15 10:33:03 -0500
commit476ef5868c39f78a438aed7066b3c94e5d33275b (patch)
tree82ad2b297d77dca44921028c2d9872863831466a /tests
parent0ffa210b47265addde8225835265a39d1b2cd17e (diff)
downloadeclipse.platform.swt-476ef5868c39f78a438aed7066b3c94e5d33275b.tar.gz
eclipse.platform.swt-476ef5868c39f78a438aed7066b3c94e5d33275b.tar.xz
eclipse.platform.swt-476ef5868c39f78a438aed7066b3c94e5d33275b.zip
Bug 475659 Data race asyncExecRan
Use AtomicBoolean instead an array to avoid concurrent read/write warning/issues. Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=475659 Change-Id: I80f5e026e1cfa6503e45e65e074de855454989cc Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java
index 2abc7ec644..bb7c5f7292 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java
@@ -20,6 +20,8 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.util.concurrent.atomic.AtomicBoolean;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.DeviceData;
import org.eclipse.swt.graphics.Font;
@@ -414,14 +416,14 @@ public void test_getSyncThread() {
// Create a runnable and invoke with asyncExec to verify that
// the syncThread is null while it's running.
- final boolean[] asyncExecRan = new boolean[] {false};
+ AtomicBoolean asyncExecRan = new AtomicBoolean(false);
display.asyncExec(() -> {
assertNull(display.getSyncThread());
- asyncExecRan[0] = true;
+ asyncExecRan.set(true);
});
try {
- while (!asyncExecRan[0]) {
+ while (!asyncExecRan.get()) {
Thread.sleep(100);
}
} catch (InterruptedException ex) {

Back to the top