Thread Task Training

Source: Internet
Author: User

1. The task class represents a thread, and the simplest task is constructed by a parameter of Action<t>, which is a generic delegate with no return value. Point to the function you want to execute. When the start () method is called, the child thread is executed. Executes a pointer to a function.

2. You can also use the Task.Factory.StartNew method, which constructs a Task and starts running immediately. Equivalent to executing the constructor of a task with the Start method.

4. Task<t> to get the return value, T is the type of the return value

5. To suspend the current thread, wait for a thread to finish, you can use the Wait () method of the execution thread, and the wait method has some overloads that specify the wait time

The results are several, including:

Thread Task Training

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.