C # Basics Review four multi-threading

Source: Internet
Author: User

Single threaded and multi-threaded differences single-threaded: only the main thread processing, if one operation occupies the main thread, then other operations will not be able to perform multithreading: In addition to the main thread, the child threads are also opened to perform operations, when the child threads perform operations, the main thread can perform other operations, but the child The thread cannot use the control of the main thread, and the main thread cannot know when the child thread will finish closing cross-thread detection so that the child can use the main thread's control
false;

Grammar

New Thread (); th. Start (); // Open Thread

To prevent the main thread and child threads from conflicting (manipulating one control at the same time), we can give the thread a loads lock so that other threads will wait for the locked thread to finish

Lock (this) {    // action }
Thread sleep lets the thread wait a few seconds before continuing execution
Thread.Sleep (MS);
Asynchronous asynchronous operations are similar to threads, but are returned to the main thread keyword async when execution is complete. IsCompleted () Whether asynchronous execution completes

C # Basics Review four multi-threading

Related Article

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.