View the three application modes of the thread from the control logic of the program

Source: Internet
Author: User
We all know that the control logic of a program mainly includes three types: sequence, branch, and loop. we apply these three control logics to three application modes with threads.
  • Mode 1: task-oriented processing
Although there may be branches and loops (short loops) during execution, the main process of the thread is in the sequential thread usage mode. For example, System. Threading. Tasks. Task in. NET4.0 is an application in this mode.
  • Mode 2: message dispatching-message dispatching
Although there may be branches in the execution process, the main process of the thread is the thread usage mode of the loop (long loop. For example, System. Windows. Threading. Dispatcher in. NET4.0 is an application in this mode.
  • Mode 3: logic-Oriented Rule Determination
Although there may be loops during execution, the main process of the thread is the thread usage mode of the branch.

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.