C # Several ways to turn off thread exit

Source: Internet
Author: User
1 // forces all messages to abort, exits all forms, but does not cleanly exit if there is a managed thread (not the main thread); 2. System.Environment.Exit (0// No matter in the main thread and other threads, as long as the execution of this sentence, you can put the program end clean 3.  this. Close (); // just close the current window, if it is not the main form, you can not quit the program, and if there is a managed thread (not the main threads), also can not cleanly exit; 4. Application.exitthread (); // Force abort all messages on the calling thread, as well as the problem that other threads cannot exit correctly;

C # Several ways to turn off thread exit

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.