Let’s say I want to “pause” a thread so that other threads can run more efficiently. What is the minimum sleeping period before blocking becomes pointless (or almost pointless)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would expect that any amount of sleeping would at least be the functional equivalent of calling
yield()so there is never a point where it is “pointless.” There is a definitely a point where a small values are essentially indistinguishable because the overhead of waiting for the Operating System to get back around to your thread is longer than a small sleep time. That probably occurs somewhere in the 5-10 range, but of course it will be OS specific.