diff options
Diffstat (limited to 'src')
8 files changed, 25 insertions, 18 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java index 88542c4..347d843 100644 --- a/src/java/com/jogamp/common/util/IOUtil.java +++ b/src/java/com/jogamp/common/util/IOUtil.java @@ -812,7 +812,7 @@ public class IOUtil { this.istreams = streams; this.ostream = ostream; this.prefix = prefix; - new Thread(this, "StreamMonitor-"+Thread.currentThread().getName()).start(); + new InterruptSource.Thread(null, this, "StreamMonitor-"+Thread.currentThread().getName()).start(); } @Override public void run() diff --git a/src/java/jogamp/android/launcher/MainLauncher.java b/src/java/jogamp/android/launcher/MainLauncher.java index 0dc6b4a..e0eff7d 100644 --- a/src/java/jogamp/android/launcher/MainLauncher.java +++ b/src/java/jogamp/android/launcher/MainLauncher.java @@ -33,6 +33,8 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; +import com.jogamp.common.util.InterruptSource; + import android.app.Activity; import android.net.Uri; import android.os.Bundle; @@ -117,17 +119,17 @@ public class MainLauncher extends Activity { public void onResume() { Log.d(TAG, "onResume - S - "+Thread.currentThread().getName()); super.onResume(); - final Thread mainThread = new Thread("Main") { + final Thread mainThread = new InterruptSource.Thread(null, null, "Main") { public void run() { try { - Log.d(TAG, "onResume - main.0 - "+Thread.currentThread().getName()); + Log.d(TAG, "onResume - main.0 - "+java.lang.Thread.currentThread().getName()); mainClazzMain.invoke(null, new Object[] { mainClassArgs } ); } catch (final InvocationTargetException ite) { ite.getTargetException().printStackTrace(); } catch (final Throwable t) { t.printStackTrace(); } - Log.d(TAG, "onResume - main.X -> finish() - "+Thread.currentThread().getName()); + Log.d(TAG, "onResume - main.X -> finish() - "+java.lang.Thread.currentThread().getName()); finish(); } }; mainThread.start(); diff --git a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java index 44a5d28..9fe7966 100644 --- a/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java +++ b/src/java/jogamp/common/util/locks/SingletonInstanceFileLock.java @@ -32,6 +32,8 @@ import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileLock; + +import com.jogamp.common.util.InterruptSource; import com.jogamp.common.util.locks.SingletonInstance; public class SingletonInstanceFileLock extends SingletonInstance { @@ -76,7 +78,7 @@ public class SingletonInstanceFileLock extends SingletonInstance { private void setupFileCleanup() { file.deleteOnExit(); - Runtime.getRuntime().addShutdownHook(new Thread() { + Runtime.getRuntime().addShutdownHook(new InterruptSource.Thread() { @Override public void run() { if(isLocked()) { diff --git a/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java b/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java index 8ac73fa..6219b5c 100644 --- a/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java +++ b/src/java/jogamp/common/util/locks/SingletonInstanceServerSocket.java @@ -77,7 +77,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance { fullName = ilh.toString()+":"+portNumber; singletonServer = new Server(ilh, portNumber); - Runtime.getRuntime().addShutdownHook(new Thread() { + Runtime.getRuntime().addShutdownHook(new InterruptSource.Thread() { @Override public void run() { singletonServer.kill(); @@ -152,7 +152,7 @@ public class SingletonInstanceServerSocket extends SingletonInstance { } synchronized (syncOnStartStop) { shallQuit = false; - serverThread = InterruptSource.Thread.create(null, this, sname); + serverThread = new InterruptSource.Thread(null, this, sname); serverThread.setDaemon(true); // be a daemon, don't keep the JVM running serverThread.start(); try { 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 .."); |