Skip to content

Instantly share code, notes, and snippets.

@pzelnip
Created April 3, 2013 18:38
Show Gist options
  • Save pzelnip/5303912 to your computer and use it in GitHub Desktop.
Save pzelnip/5303912 to your computer and use it in GitHub Desktop.
Maxing out CPU cores
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