File tree Expand file tree Collapse file tree
src/main/java/jaci/openrio/toast/core/thread Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- toast.version=1.3.2
1+ toast.version=1.3.3
Original file line number Diff line number Diff line change 22
33import jaci .openrio .toast .core .ToastConfiguration ;
44
5- import java .util .concurrent .ExecutorService ;
6- import java .util .concurrent .Executors ;
7- import java .util .concurrent .ThreadFactory ;
8- import java .util .concurrent .TimeUnit ;
5+ import java .util .concurrent .*;
96import java .util .concurrent .atomic .AtomicInteger ;
107
118/**
@@ -61,8 +58,18 @@ public static void init() {
6158 * @param runnable The Runnable Instance to trigger when running. This can be an anonymous member, which is the intended
6259 * implementation, although you can extend this interface and it will work just as well.
6360 */
64- public void addWorker (Runnable runnable ) {
65- threadPool .execute (runnable );
61+ public Future addWorker (Runnable runnable ) {
62+ return threadPool .submit (runnable );
63+ }
64+
65+ /**
66+ * Add a new Worker to the Thread Pool. For basic usage, this is the only function you should call. This will schedule
67+ * a task to run when the Thread is not busy (add it to the queue).
68+ * @param callable The Callable Instance to trigger when running. This can be an anonymous member, which is the intended
69+ * implementation, although you can extend this interface and it will work just as well.
70+ */
71+ public Future addWorker (Callable callable ) {
72+ return threadPool .submit (callable );
6673 }
6774
6875 /**
You can’t perform that action at this time.
0 commit comments