From 453ccee8e3ce90956756d1582852b13f45cd2f38 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 9 Jul 2013 15:04:50 +0200 Subject: NEWT EDTUtil: Exposed weakness of EDTUtil usage due to usage of WeakReference, i.e. higher retention of Display instances. - WeakReference Change 99479bf3197cde8e89c5b499d135417863d521c7 - Refines commits: feb352145af1643a57eaae99c0342e6f5e0f2a2e dec4b02fe4b93028c85de6a56b6af79601042d6e 433e3914324b90c910b018bb7d9d80e814c67123 Reviews EDTUtil API and usage: - less confusing / more determined EDTUtil API - EDTUtil's thread shall only be reset and started when required (-> lazy) - EDTUtil's instance in Display shall be handled thread safe w/o extra blocking - EDTUtil's implementations (Default, SWT and AWT) shall be aligned / similar as much as possible Further note: SWT's EDTUtil (NewtCanvasSWT) shall not use a reused Display instance due to it's custom SWTEDTUtil. We may need to disable the ref. cache if custom EDTUtil (setEDTUtil) is intended (used). --- .../test/junit/jogl/acore/InitConcurrentBaseNEWT.java | 6 +++++- .../junit/jogl/acore/TestInitConcurrent01NEWT.java | 11 +++-------- .../junit/jogl/acore/TestInitConcurrent02NEWT.java | 3 +-- .../demos/es2/newt/TestGearsES2NewtCanvasSWT.java | 6 ++++-- .../swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java | 9 +++++++-- .../test/junit/jogl/swt/TestNewtCanvasSWTGLn.java | 10 ++++++++-- .../test/junit/jogl/swt/TestSWTBug643AsyncExec.java | 10 +++++++--- .../test/junit/newt/TestDisplayLifecycle01NEWT.java | 19 ++++++++++++++----- .../junit/newt/parenting/TestParenting01NEWT.java | 2 +- .../junit/newt/parenting/TestParenting01aSWT.java | 7 ++++++- .../test/junit/newt/parenting/TestParenting04SWT.java | 10 ++++++++-- 11 files changed, 64 insertions(+), 29 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java index f8e6ee5d3..f1bc0ab7a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java @@ -184,6 +184,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { } protected void runJOGLTasks(int num, boolean reuse) throws InterruptedException { + System.err.println("InitConcurrentBaseNEWT "+num+" threads, reuse display: "+reuse); final String currentThreadName = Thread.currentThread().getName(); final Object syncDone = new Object(); final JOGLTask[] tasks = new JOGLTask[num]; @@ -198,13 +199,16 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { for(i=0; i */ public class TestInitConcurrent01NEWT extends InitConcurrentBaseNEWT { - static boolean mainRun = false; - + @Test(timeout=180000) // TO 3 min public void test02TwoThreads() throws InterruptedException { runJOGLTasks(2, true); @@ -56,8 +55,7 @@ public class TestInitConcurrent01NEWT extends InitConcurrentBaseNEWT { @Test(timeout=300000) // TO 5 min public void test16SixteenThreads() throws InterruptedException { - if( !mainRun && - Platform.getCPUFamily() != Platform.CPUFamily.ARM && + if( Platform.getCPUFamily() != Platform.CPUFamily.ARM && Platform.getOSType() != Platform.OSType.WINDOWS ) { runJOGLTasks(16, true); } else { @@ -66,11 +64,8 @@ public class TestInitConcurrent01NEWT extends InitConcurrentBaseNEWT { } public static void main(String args[]) throws IOException { - mainRun = true; for(int i=0; i