搜索

首页  >  问答  >  正文

android - java线程池中的代码一定在子线程吗

比如这样

public final class ThreadPool {
    private final static ExecutorService fixThreadPool = Executors.newFixedThreadPool(Runtime
            .getRuntime().availableProcessors() + 1);

    private ThreadPool() {
    }

    public static void execute(Runnable run) {
        fixThreadPool.execute(run);
    }
}
PHP中文网PHP中文网2889 天前286

全部回复(2)我来回复

  • 大家讲道理

    大家讲道理2017-04-18 09:16:08

    吼~你这种代码的情况下肯定是在“子线程”

    回复
    0
  • 阿神

    阿神2017-04-18 09:16:08

    FixedThreadPool就是内部维护一个子线程数组,所以你为什么要问这个问题?你的困惑在哪里?

    回复
    0
  • 取消回复