About Thread. Sleep (0)

Source: Internet
Author: User

Thread. Sleep (0) indicates that the Thread is suspended for 0 milliseconds. You may feel that it is useless. You have to write Thread. Sleep (1000. It seems meaningless.

MSDN Description: Specify zero (0) to indicate that this thread should be suspended so that other waiting threads can be executed.
Thread. sleep (0) does not mean that the Thread must be suspended for 0 milliseconds. It indicates that Thread is called this time. the current thread of Sleep (0) is indeed frozen, giving other threads the opportunity to execute first. Thread. Sleep (0) indicates that your Thread temporarily abandons the cpu, that is, releasing unused time slices for other threads or processes, which is equivalent to a give-up action.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.