[2014-9-12] Multithreading

Source: Internet
Author: User

It's Friday and it's going to be a good day.

Threads are foreground threads by default, and all foreground threads exit after the program is launched.

The default threads in a process are called the main thread or the UI thread.

As long as there is a foreground thread running, the application process is running, and if multiple foreground threads are running, and the Main method is finished, the application process is still active until all foreground threads are completed.

Thread re-entry: multiple threads accessing the same resource can cause an out of sync situation, using the keyword lock (this).

Call the Start method of thread, you can create a thread, after calling the Start method, the new thread is still not in the running state, but the unstarted state, only the operating system thread Scheduler chooses the

Thread, the thread will change to the running state, with the ThreadState property, to get the current state of the thread

Using Thread.Sleep () to put a thread in WaitSleepJoin, after a defined time, the thread waits to be awakened again

Stops a thread. Call the Abort method.

[2014-9-12] Multithreading

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.