lpr-b:maintermina
no way to compare when less than two revisions
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
— | lpr-b:maintermina [05/10/2007 alle 18:16 (17 anni fa)] (versione attuale) – creata Marco Danelutto | ||
---|---|---|---|
Linea 1: | Linea 1: | ||
+ | <code java> | ||
+ | package threadPoolConTerminazione; | ||
+ | |||
+ | public class ProvaThreadPool { | ||
+ | |||
+ | public static void main(String[] args) { | ||
+ | |||
+ | final int N = 8; | ||
+ | final int T = 4; | ||
+ | |||
+ | Repository< | ||
+ | Repository< | ||
+ | FunzioneSemplice funz = new FunzioneSemplice(); | ||
+ | ComputerThread[] ct = new ComputerThread[T]; | ||
+ | |||
+ | Generatore generatore = new Generatore(N, | ||
+ | Stampatore< | ||
+ | generatore.start(); | ||
+ | stampatore.start(); | ||
+ | |||
+ | System.out.println(" | ||
+ | for(int i=0; i<T; i++) { | ||
+ | ct[i] = new ComputerThread< | ||
+ | ct[i].start(); | ||
+ | } | ||
+ | System.out.println(" | ||
+ | for(int i=0; i<T; i++) { | ||
+ | try { | ||
+ | ct[i].join(); | ||
+ | } catch (InterruptedException e) { | ||
+ | e.printStackTrace(); | ||
+ | } | ||
+ | } | ||
+ | System.out.println(" | ||
+ | stampatore.interrupt(); | ||
+ | System.out.println(" | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ |
lpr-b/maintermina.txt · Ultima modifica: 05/10/2007 alle 18:16 (17 anni fa) da Marco Danelutto