Why does an IllegalThreadStateException occur when Thread.start is called again

后端 未结 7 1728
攒了一身酷
攒了一身酷 2020-12-01 16:15
public class SieveGenerator{

static int N = 50;
public static void main(String args[]){

    int cores = Runtime.getRuntime().availableProcessors();

    int f[] =          


        
7条回答
  •  爱一瞬间的悲伤
    2020-12-01 16:52

    ThreadPools can be used for delivering tasks to set number of threads. When initiating you set the number of threads. Then you add tasks for the pool. And after you can block until all tasks have finished processing. Here is some sample code.

提交回复
热议问题