Question about threads | Sololearn: Learn to code for FREE!


Question about threads

Why this code do not print in console string "Second thread stopped"?

12/6/2019 9:48:12 AM

Rustam Aliev

5 Answers

New Answer


It print....


it looks like you some some infinite loops setup.


laura , loop in main() just for testing thread - not infinite loop ;-) id001x , i don't understand whats happened, but it print only after publishing. When script is beeing private, console does not printing last string from second thread. 2All: thanks a lot!


Welcome! 🙃 May be in the end was "Time exceeded"...


@Rustam Allev When I ran the code as is... it never completed and nothing was displayed. when I changed to (a == b). It ran and statements were printed out. The 2nd statement did not print. I changed the while (!threadstops) to While(threadstops). the 2nd statement did print and it did not run continuously. I haven't messed with threading hardly at all.. ... it's just what I observed..and I don't know if this helps. 😃 I'm sure someone else may come along and give a better answer.