搜尋

首頁  >  問答  >  主體

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 天前282

全部回覆(2)我來回復

  • 大家讲道理

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

    吼~你這種程式碼的情況下一定是在「子執行緒」

    回覆
    0
  • 阿神

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

    FixedThreadPool就是內部維護一個子執行緒數組,所以為什麼要問這個問題?你的困惑在哪裡?

    回覆
    0
  • 取消回覆