diff options
author | Sven Gothel <[email protected]> | 2015-09-15 06:36:35 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-09-15 06:36:35 +0200 |
commit | 3e40d97a9a7a60e746b3703d2c7d3f4884159a52 (patch) | |
tree | b7682721b8486025d18adcea3e3dba79e510622b /src/junit | |
parent | 1c4e2d3ea379fe6578dfb84e10f22729b71b1ae5 (diff) |
Bug 1213: Use InterruptSource.Thread
Diffstat (limited to 'src/junit')
4 files changed, 14 insertions, 11 deletions
diff --git a/src/junit/com/jogamp/common/util/TestRunnableTask01.java b/src/junit/com/jogamp/common/util/TestRunnableTask01.java index 76c2d2a..6fd8f19 100644 --- a/src/junit/com/jogamp/common/util/TestRunnableTask01.java +++ b/src/junit/com/jogamp/common/util/TestRunnableTask01.java @@ -60,7 +60,7 @@ public class TestRunnableTask01 extends SingletonJunitCase { System.err.println("BB.0: "+syncObject); synchronized (syncObject) { System.err.println("BB.1: "+syncObject); - new Thread(clientAction, Thread.currentThread().getName()+"-clientAction").start(); + new InterruptSource.Thread(null, clientAction, Thread.currentThread().getName()+"-clientAction").start(); try { System.err.println("BB.2"); syncObject.wait(); @@ -88,7 +88,7 @@ public class TestRunnableTask01 extends SingletonJunitCase { System.err.println("BB.0: "+rTask.getSyncObject()); synchronized (rTask.getSyncObject()) { System.err.println("BB.1: "+rTask.getSyncObject()); - new Thread(rTask, Thread.currentThread().getName()+"-clientAction").start(); + new InterruptSource.Thread(null, rTask, Thread.currentThread().getName()+"-clientAction").start(); try { System.err.println("BB.2"); rTask.getSyncObject().wait(); diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java index 4508f94..7455618 100644 --- a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java +++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java @@ -38,6 +38,7 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.InterruptSource; import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; @@ -170,7 +171,7 @@ public class TestRecursiveLock01 extends SingletonJunitCase { public final void action2Deferred(final int l, final YieldMode yieldMode) { final Action2 action2 = new Action2(l, yieldMode); - new Thread(action2, Thread.currentThread().getName()+"-deferred").start(); + new InterruptSource.Thread(null, action2, Thread.currentThread().getName()+"-deferred").start(); } public final void lock() { @@ -296,14 +297,14 @@ public class TestRecursiveLock01 extends SingletonJunitCase { final long t0 = System.currentTimeMillis(); final LockedObject lo = new LockedObject(implType, fair); final LockedObjectRunner[] runners = new LockedObjectRunner[threadNum]; - final Thread[] threads = new Thread[threadNum]; + final InterruptSource.Thread[] threads = new InterruptSource.Thread[threadNum]; int i; for(i=0; i<threadNum; i++) { runners[i] = new LockedObjectRunner1(lo, loops, iloops, yieldMode); // String name = Thread.currentThread().getName()+"-ActionThread-"+i+"_of_"+threadNum; final String name = "ActionThread-"+i+"_of_"+threadNum; - threads[i] = new Thread( runners[i], name ); + threads[i] = new InterruptSource.Thread( null, runners[i], name ); threads[i].start(); } diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java index e35d146..30a0274 100644 --- a/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java +++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java @@ -34,6 +34,7 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.InterruptSource; import com.jogamp.junit.util.SingletonJunitCase; import org.junit.FixMethodOrder; @@ -239,15 +240,15 @@ public class TestRecursiveThreadGroupLock01 extends SingletonJunitCase { final LockedObject lo = new LockedObject(); final LockedObjectRunner[] concurrentRunners = new LockedObjectRunner[concurrentThreadNum]; final LockedObjectRunner[] slaveRunners = new LockedObjectRunner[slaveThreadNum]; - final Thread[] concurrentThreads = new Thread[concurrentThreadNum]; - final Thread[] slaveThreads = new Thread[slaveThreadNum]; - final Thread[] noCoOwnerThreads = new Thread[0]; + final InterruptSource.Thread[] concurrentThreads = new InterruptSource.Thread[concurrentThreadNum]; + final InterruptSource.Thread[] slaveThreads = new InterruptSource.Thread[slaveThreadNum]; + final InterruptSource.Thread[] noCoOwnerThreads = new InterruptSource.Thread[0]; int i; for(i=0; i<slaveThreadNum; i++) { slaveRunners[i] = new LockedObjectRunner1(" ", "s"+i, lo, loops, mark, yieldMode); final String name = "ActionThread-Slaves-"+i+"_of_"+slaveThreadNum; - slaveThreads[i] = new Thread( slaveRunners[i], name ); + slaveThreads[i] = new InterruptSource.Thread( null, slaveRunners[i], name ); } for(i=0; i<concurrentThreadNum; i++) { String name; @@ -258,7 +259,7 @@ public class TestRecursiveThreadGroupLock01 extends SingletonJunitCase { concurrentRunners[i] = new LockedObjectRunner1(" ", "O"+i, lo, noCoOwnerThreads, loops, mark, yieldMode); name = "ActionThread-Others-"+i+"_of_"+concurrentThreadNum; } - concurrentThreads[i] = new Thread( concurrentRunners[i], name ); + concurrentThreads[i] = new InterruptSource.Thread( null, concurrentRunners[i], name ); concurrentThreads[i].start(); if(i==0) { // master thread w/ slaves shall start first diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java index a1a9965..ce0087a 100644 --- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java +++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java @@ -35,6 +35,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; +import com.jogamp.common.util.InterruptSource; import com.jogamp.junit.util.JunitTracer; import com.jogamp.junit.util.SingletonJunitCase; @@ -70,7 +71,7 @@ public class TestSingletonServerSocket00 extends JunitTracer { } private Thread startLockUnlockOffThread(final int i) { - final Thread t = new Thread(new Runnable() { + final Thread t = new InterruptSource.Thread(null, new Runnable() { public void run() { final SingletonInstance myLock = SingletonInstance.createServerSocket(10, SingletonJunitCase.SINGLE_INSTANCE_LOCK_PORT); System.err.println(Thread.currentThread().getName()+" LOCK try .."); |