Lines Matching refs:thread
32 The previous lesson showed you how to define a class that manages thread pools and the tasks
33 that run on them. This lesson shows you how to run a task on a thread pool. To do this,
34 you add the task to the pool's work queue. When a thread becomes available, the
36 thread.
41 time, you can cancel the thread the task is running on. For example, if you are downloading
48 To start a task object on a thread in a particular thread pool, pass the
50 ThreadPoolExecutor.execute()}. This call adds the task to the thread pool's work queue. When an
51 idle thread becomes available, the manager takes the task that has been waiting the longest and
52 runs it on the thread:
72 thread, it automatically calls the object's {@link java.lang.Runnable#run run()} method.
76 To stop a task, you need to interrupt the task's thread. To prepare to do this, you need to
77 store a handle to the task's thread when you create the task. For example:
94 To interrupt a thread, call {@link java.lang.Thread#interrupt Thread.interrupt()}. Notice that
96 your app's process. For this reason, you need to lock access on a thread before you
104 * thread pool work queue
117 // Gets the current thread
118 Thread thread = runnableArray[taskArrayIndex].mThread;
120 if (null != thread) {
121 thread.interrupt();
130 In most cases, {@link java.lang.Thread#interrupt Thread.interrupt()} stops the thread