When i specifiy the time interval zero
static void Main()
{
Thead.Sleep(0);
}
would the Main() thread give up the CPU resource it acquired or without waiting will it continue?
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.
Yes.
The thread shall be suspended for that cycle allowing other threads access to the CPU. The code will be immediately scheduled for the next cycle.
The thread will continue being processed on it’s next scheduled CPU slot in a multithreaded environment.
Thread.Sleep(-1) will suspend the thread indefinitely.