Hacker News new | past | comments | ask | show | jobs | submit login

In Java, unless they changed something in the past ~6 months, virtual threads will not "swap out" a CPU bound task, you have to have some blocking, otherwise it will keep on chugging.

Depending upon your POV this may be a positive or negative. You can get around it by manually inserting some sleeps() - note that yield() won't work (which is kinda unfortunate).




Does sleep(0) also work?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: