Created
April 3, 2013 18:38
-
-
Save pzelnip/5303912 to your computer and use it in GitHub Desktop.
Maxing out CPU cores
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class TestTest implements Runnable { | |
public static void main(String [] args) throws InterruptedException { | |
List<Thread> threads = new ArrayList<Thread>(); | |
for (int x = 0; x < 10; x++) { | |
threads.add(new Thread(new TestTest())); | |
} | |
for (Thread t : threads) { | |
t.start(); | |
} | |
threads.get(0).join(); | |
} | |
@Override | |
public void run() { | |
int x = 0; | |
while (true) { | |
x++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment