簡體   English   中英

如何獲取線程池中當前並行運行的AsyncTask的總數?

[英]How to get the total number of AsyncTasks currently running in parallel in the thread pool?

在計划新的AsyncTask之前,我需要檢查當前並行執行的AsyncTask的數量,以便僅在並發任務的數量小於最大池大小時才計划新任務。

獲取池中所有當前任務計數的最佳方法是什么?

返回正在主動執行任務的線程的大概數量。

 threadPool.getActiveCount()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM