What are common mistakes made in multithreaded programming?
quora.com
quora.com
I see this debug pattern in a lot of tutorials, but no explanation why they show it, and no guidance when to turn it off.
I have also seen bugs that rely on the sleep for functionality to work correctly and have had to fix logic to turn off the sleep. So it is good practice to test production release mode after initial development in dev release mode.