Hirdetés
Új hozzászólás Aktív témák
-
btotyi
tag
Például így :
package test;
class Szal extends java.lang.Thread {
volatile static boolean Stop = false;
// Primordial thread executes main()
public static void main(String args[]) throws InterruptedException {
// Create and start 2 threads
Szal thread1 = new Szal();
thread1.setPriority(1); // 1st thread at 1th non-RT priority
Szal thread2 = new Szal();
thread2.setPriority(1); // 2nd thread at 1th non-RT priority
thread1.start(); // start 1st thread to execute run()
thread2.start(); // start 2nd thread to execute run()
// Sleep for 10 seconds, then tell the threads to terminate
Thread.sleep(10 * 1000);
Stop = true;
}
public void run() { // Created threads execute this method
System.out.println(''Created thread'');
int count = 0;
for (; Stop != true;) { // continue until asked to stop
count++;
Thread.yield(); // yield to other thread
}
System.out.println(''Thread terminates. Loop count is '' + count);
}
}
forrás:[link]
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- Garis! Hisense 55E7Q 139CM Qled Smart 4K TV
- Samsung, SK Hynix 8GB / 16GB / 32GB DDR5 laptop Memoria!
- UNIQUE SHELL ergonomikus, szövet irodai szék
- Gamer PC - Számítógép // i7 // GTX 1060 // Számla // Garancia //
- Akció! Csere-Beszámítás! Asus ROG G614J! I7 13650HX / RTX 4060 / 16GB DDR5 / 1TB Nvme SSD
- Dell Latitude E7270,12.5",FHD,i7-6600U,8GB DDR4,256GB SSD,WIN11
- BESZÁMÍTÁS! Részletfizetés 0% THM ÚJ Sony PlayStation 5 Slim digital / lemezes / Pro konzol 27% áfa
- BESZÁMÍTÁS! Asus Z690 i5 13600K 32GB DDR4 1TB SSD RX 6800 XT 16GB Aerocool P500B Digi ARGB 850W
- Asus TUF A15 FX506 - 15.6" Full HD 144Hz - Ryzen 5-4600H - 8GB - 512GB - Win11 - GTX 1650 Ti - HUN
- BESZÁMÍTÁS! Lian Li Galahad II 360ARGB white bontattlan vízhűtés garanciával hibátlan működéssel
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
