3 ms·
You can call Thread.yield() at any time. They are preemptive, and many things you do which will block effectively call Thread.yield() to give other things a ch
by b2gills 9y ago
You can call Thread.yield() at any time.
They are preemptive, and many things you do which will block effectively call Thread.yield() to give other things a chance to run.
I once wrote some code which took my 4 core CPU to about 500% utilization, and it was very simple code. (on a hyperthreaded Core I7) It was purposefully written to be fairly daft, as there were plenty of better ways to write it. I just wanted to see what would happen, and how long it would take to complete.