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.