Calling sleep is almost the same as a //TODO in your code.  It is very rare that it is the appropriate way to solve the problem.  What you are normally doing is saying, "wait until x happens, which will probably happen in under t time".  You should always try to find a way to verify that x has happened and then send a notification to the waiting thread.

 

I sometimes use sleep to prove that my issue is a synchronization issue and then come back and write the logic.  Of course, there are cases where it is necessary.