DEV Community

loading...

Discussion on: Multithreading in Java for dummies (part 2)

Collapse
raulavila profile image
Raúl Ávila Author

If I understood correctly, I think that means the Thread scheduler does not start the two "players" in those 2ms, so the main thread requests the interruption before they can enter in the loop to play. It's weird, but it can happen. Have you tried increasing the sleep time to let's say, 10 or 20ms?

Collapse
codeismail profile image
Ismail Ibrahim

Exactly. I thought so too. It works well with 10.👍