Detailed explanation of the difference between Android main thread and sub thread

Difference between main thread and sub thread

Each thread has a unique identifier to distinguish the primary and secondary relationship in the thread. Thread unique identifier: thread.currentthread.managedthreadid;

No more. Look at the test code comments below.

Summary:

1. What is a child thread?

Included in thread = new thread (New threadstart (delegate {})); All of them are regarded as child threads. 2. What is the main thread?

When a program starts, a process is created by the operating system (OS) and a thread runs immediately. This thread is usually called the main thread of the program, because it is executed at the beginning of the program. If you need to create another thread, the created thread is the child thread of the main thread. Each process has at least

There is a main thread. In WinForm, it should be the thread that creates the GUI. The importance of the main thread is reflected in two aspects: 1. It is the thread that produces other sub threads; 2. Usually, it must be executed finally, such as various closing actions.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>