资源简介
小游戏超级玛丽项目.
代码片段和文件信息
package com.brackeen.javagamebook.util;
import java.util.linkedList;
/**
A thread pool is a group of a limited number of threads that
are used to execute tasks.
*/
public class ThreadPool extends ThreadGroup {
private boolean isAlive;
private linkedList taskQueue;
private int threadID;
private static int threadPoolID;
/**
Creates a new ThreadPool.
@param numThreads The number of threads in the pool.
*/
public ThreadPool(int numThreads) {
super(“ThreadPool-“ + (threadPoolID++));
setDaemon(true);
isAlive = true;
taskQueue = new linkedList();
for (int i=0; i new PooledThread().start();
}
}
/**
Requests a new t
评论
共有 条评论