aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/FunctionTask.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/util/FunctionTask.java')
-rw-r--r--src/java/com/jogamp/common/util/FunctionTask.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/java/com/jogamp/common/util/FunctionTask.java b/src/java/com/jogamp/common/util/FunctionTask.java
index 630ae2f..9eb1ca5 100644
--- a/src/java/com/jogamp/common/util/FunctionTask.java
+++ b/src/java/com/jogamp/common/util/FunctionTask.java
@@ -42,10 +42,21 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> {
protected A[] args;
/**
- * @deprecated Simply invoke {@link Function#eval(Object...)}
+ * Invokes <code>func</code> on the current {@link Thread}.
+ * <p>
+ * The result can be retrieved via {@link FunctionTask#getResult()},
+ * using the returned instance.
+ * </p>
+ * @param func the {@link Function} to execute.
+ * @param args the {@link Function} arguments
+ * @return the newly created and invoked {@link FunctionTask}
+ * @since 2.4.0
*/
- public static <U,V> U invoke(final boolean waitUntilDone, final Function<U,V> func, final V... args) {
- return func.eval(args);
+ public static <U,V> FunctionTask<U,V> invokeOnCurrentThread(final Function<U,V> func, final V... args) {
+ final FunctionTask<U,V> rt = new FunctionTask<U,V>( func, null, false, null);
+ rt.args = args;
+ rt.run();
+ return rt;
}
/**