From 1c4e2d3ea379fe6578dfb84e10f22729b71b1ae5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 15 Sep 2015 05:12:14 +0200 Subject: 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 --- src/java/com/jogamp/common/util/RunnableTask.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/java/com/jogamp/common/util/RunnableTask.java') 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 runnable on a new thread belonging to the given {@link ThreadGroup}. + * Invokes runnable 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 null + * @param threadName the name for the new thread, maybe null * @param waitUntilDone if true, waits until runnable execution is completed, otherwise returns immediately. * @param runnable the {@link Runnable} to execute on the new thread. If waitUntilDone is true, - * the runnable must exist, i.e. not loop forever. - * @param threadName the name for the new thread + * the runnable must exit, 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() ) { -- cgit v1.2.3