aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/RunnableTask.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-09-15 05:12:14 +0200
committerSven Gothel <[email protected]>2015-09-15 05:12:14 +0200
commit1c4e2d3ea379fe6578dfb84e10f22729b71b1ae5 (patch)
tree6bcd646a474bcf0c79043fe2520ccaa51a57eea1 /src/java/com/jogamp/common/util/RunnableTask.java
parent2b97ed6d238a0db1e2cf7bdf15349e90eaaa8dfc (diff)
Bug 1213: Refine changes .. comments and API
- Use InterruptSource.Thread.create(..), while reducing InterruptSource.Thread ctors to 3 variants. - Use InterruptSource.Thread instead of java.lang.Thread where possible - Use SourcedInterruptedException where possible - SingletonInstanceServerSocket: start(), stop() and run() - Persistent-Wait and Cancelable - Add @since 2.3.2
Diffstat (limited to 'src/java/com/jogamp/common/util/RunnableTask.java')
-rw-r--r--src/java/com/jogamp/common/util/RunnableTask.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/java/com/jogamp/common/util/RunnableTask.java b/src/java/com/jogamp/common/util/RunnableTask.java
index 69d7af2..57809b9 100644
--- a/src/java/com/jogamp/common/util/RunnableTask.java
+++ b/src/java/com/jogamp/common/util/RunnableTask.java
@@ -55,25 +55,27 @@ public class RunnableTask extends TaskBase {
}
/**
- * Invokes <code>runnable</code> on a new thread belonging to the given {@link ThreadGroup}.
+ * Invokes <code>runnable</code> on a new {@link InterruptSource.Thread},
+ * see {@link InterruptSource.Thread#Thread(ThreadGroup, Runnable, String)} for details.
* @param tg the {@link ThreadGroup} for the new thread, maybe <code>null</code>
+ * @param threadName the name for the new thread, maybe <code>null</code>
* @param waitUntilDone if <code>true</code>, waits until <code>runnable</code> execution is completed, otherwise returns immediately.
* @param runnable the {@link Runnable} to execute on the new thread. If <code>waitUntilDone</code> is <code>true</code>,
- * the runnable <b>must exist</b>, i.e. not loop forever.
- * @param threadName the name for the new thread
+ * the runnable <b>must exit</b>, i.e. not loop forever.
* @return the newly created and invoked {@link RunnableTask}
+ * @since 2.3.2
*/
public static RunnableTask invokeOnNewThread(final ThreadGroup tg, final String threadName,
final boolean waitUntilDone, final Runnable runnable) {
final RunnableTask rt;
if( !waitUntilDone ) {
rt = new RunnableTask( runnable, null, true, System.err );
- final InterruptSource.Thread t = new InterruptSource.Thread(tg, rt, threadName);
+ final InterruptSource.Thread t = InterruptSource.Thread.create(tg, rt, threadName);
t.start();
} else {
final Object sync = new Object();
rt = new RunnableTask( runnable, sync, true, null );
- final InterruptSource.Thread t = new InterruptSource.Thread(tg, rt, threadName);
+ final InterruptSource.Thread t = InterruptSource.Thread.create(tg, rt, threadName);
synchronized(sync) {
t.start();
while( rt.isInQueue() ) {