简体   繁体   中英

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

I need to check the number of AsyncTasks currently executing in parallel before scheduling a fresh AsyncTask so that the fresh task is scheduled only if the number of concurrent tasks is lesser than the maximum pool size.

What is the best way to get the count of all current tasks in the pool?

返回正在主动执行任务的线程的大概数量。

 threadPool.getActiveCount()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM