Is there any difference(performance, implementation. .whatever) between the following:
i)
DllImport("kernel32.dll")]
public extern static void Sleep(uint msec);
..then call Sleep function
ii)
Thread.Sleep()
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.
There’s a big difference, actually.
This blog post explains why managed threads should never do unmanaged blocking, if possible. The official MSDN documentation has the same guideline without all the underlying details.
P.S.
Thread.Sleepis a sign of a poorly-designed program.