Start all given threads and wait on each of them until all are done. From Stephan Preibisch's Multithreading.java class. See: http://repo.or.cz/w/trakem2.git?a=blob;f=mpi/fruitfly/general/MultiThreading.java;hb=HEAD @param threads
(Thread[] threads)
| 9 | * @param threads |
| 10 | */ |
| 11 | public static void startAndJoin(Thread[] threads) { |
| 12 | for (int ithread = 0; ithread < threads.length; ++ithread) { |
| 13 | threads[ithread].setPriority(Thread.NORM_PRIORITY); |
| 14 | threads[ithread].start(); |
| 15 | } |
| 16 | |
| 17 | try { |
| 18 | for (int ithread = 0; ithread < threads.length; ++ithread) { |
| 19 | threads[ithread].join(); |
| 20 | } |
| 21 | } catch (InterruptedException ie) { |
| 22 | throw new RuntimeException(ie); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | public static Thread[] createThreadArray(int nb) { |
| 27 | if (nb == 0) { |
no test coverage detected