I used to see Sleep(0) in some part of my code where some infinite/long while loops are available. I was informed that it would make the time-slice
I'm afraid I can't improve on the MSDN docs here
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution.
Windows XP/2000: A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. This behavior changed starting with Windows Server 2003.
Please also note (via upvote) the two useful answers regarding efficiency problems here.