更新时间:2023-01-23 21:32:18
AsyncTask的使用线程池技术。你开始每个AsyncTask的进入队列;有一些空闲线程中的池(或它们根据需要达到一定的极限创建)等待的任务。从池中的空闲线程需要你的AsyncTask并执行它,然后返回到池中。然后,该过程重复,直到没有更多的任务在队列中。
AsyncTask uses "thread pool" technique. Each AsyncTask you start gets into a queue; there are some idle threads in the "pool" (or they are created as needed up to a certain limit) waiting for tasks. An idle thread from the pool takes your AsyncTask and executes it, then returns to the pool. Then the process repeats until there are no more tasks in the queue.
该方法具有两个重要的特点:
This approach has 2 important features:
你你的AsyncTask结束后,在DDMS看到的线程池中的空闲线程。
The thread which you see in DDMS after your AsyncTask finished is the idle thread in the pool.