Foreground thread and Background thread (Foreground and Background Threads)

Source: Internet
Author: User

I learned multithreading this week, recorded some ideas and learned things, and shared them with you. You are welcome to correct the incorrect description.

This section describes the foreground and background threads.

There is only one difference between the foreground thread and the background thread:

  • Background thread: when the program ends, all background threads are immediately interrupted. Even if the background thread is running finally code. The terminated background thread does not expose exceptions. Unless the program is terminated by AppDomain. Unload.
  • Front-end thread: When any front-end thread is running, the program will not end and will wait until the front-end thread ends,

The foreground Thread and background Thread can be converted at any time through Thread. IsBackground property.

All threads in the thread pool are backend threads.

The threads enabled by the unmanaged code are all background threads.

By default, all threads created using the new thread are foreground threads.

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.