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?:))
- Samsung Galaxy A54 - türelemjáték
- Samsung Galaxy Watch6 Classic - tekerd!
- OLED monitor topic
- Amlogic S905, S912 processzoros készülékek
- A piac legerősebb kameráját ígéri a Xiaomi 17 Ultra
- iPhone topik
- Milyen videókártyát?
- LEGO klub
- HiFi műszaki szemmel - sztereó hangrendszerek
- Fogyjunk le!
- További aktív témák...
- Honor 400 Lite / 8/256GB / Kártyafüggetlen / 12Hó Garancia
- Apple iPhone 12 Pro Max / 128GB / Kártyafüggetlen / 12Hó garancia
- BESZÁMÍTÁS! MSI B450M R7 5700X 32GB DDR4 500GB SSD RTX 4060 Ti 8GB Zalman Z1 PLUS Cooler Master 700W
- BESZÁMÍTÁS! MSI B450M R5 5600X 16GB DDR4 500GB SSD RTX 3060Ti 8GB SilentiumPC Signum SG1 TG FSP 700W
- Apple iPhone 13 Pro 256GB, Kártyafüggetlen, 1 Év Garanciával
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopszaki Kft.
Város: Budapest


