diff options
author | Sven Gothel <[email protected]> | 2015-09-15 05:12:14 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-09-15 05:12:14 +0200 |
commit | 1c4e2d3ea379fe6578dfb84e10f22729b71b1ae5 (patch) | |
tree | 6bcd646a474bcf0c79043fe2520ccaa51a57eea1 /src/java/com/jogamp/common/util/FunctionTask.java | |
parent | 2b97ed6d238a0db1e2cf7bdf15349e90eaaa8dfc (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/FunctionTask.java')
-rw-r--r-- | src/java/com/jogamp/common/util/FunctionTask.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/java/com/jogamp/common/util/FunctionTask.java b/src/java/com/jogamp/common/util/FunctionTask.java index 5a58a34..630ae2f 100644 --- a/src/java/com/jogamp/common/util/FunctionTask.java +++ b/src/java/com/jogamp/common/util/FunctionTask.java @@ -49,30 +49,32 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> { } /** - * Invokes <code>func</code> on a new thread belonging to the given {@link ThreadGroup}. + * Invokes <code>func</code> on a new {@link InterruptSource.Thread}, + * see {@link InterruptSource.Thread#Thread(ThreadGroup, Runnable, String)} for details. * <p> * The result can be retrieved via {@link FunctionTask#getResult()}, * using the returned instance. * </p> * @param tg the {@link ThreadGroup} for the new thread, maybe <code>null</code> - * @param threadName the name for the new thread + * @param threadName the name for the new thread, maybe <code>null</code> * @param waitUntilDone if <code>true</code>, waits until <code>func</code> execution is completed, otherwise returns immediately. * @param func the {@link Function} to execute. * @param args the {@link Function} arguments * @return the newly created and invoked {@link FunctionTask} + * @since 2.3.2 */ public static <U,V> FunctionTask<U,V> invokeOnNewThread(final ThreadGroup tg, final String threadName, final boolean waitUntilDone, final Function<U,V> func, final V... args) { final FunctionTask<U,V> rt; if( !waitUntilDone ) { rt = new FunctionTask<U,V>( func, null, true, System.err ); - final InterruptSource.Thread t = new InterruptSource.Thread(tg, rt, threadName); + final InterruptSource.Thread t = InterruptSource.Thread.create(tg, rt, threadName); rt.args = args; t.start(); } else { final Object sync = new Object(); rt = new FunctionTask<U,V>( func, 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) { rt.args = args; t.start(); |