C + + Multithreading

Source: Internet
Author: User

C + + Multithreading Get started thread introduction: https://www.cnblogs.com/vsuu/p/4170325.html

Join () && detach () && joinable ()

When the Thread::join () function is called, the thread that invokes it is blocked until the thread's execution is completed. Basically, this is a mechanism that you can use to know that a thread has ended. When Thread::join () returns, the executing thread of the OS has completed and the C + + thread object can be destroyed.

When thread::d the Etach () function is called, the executing thread is detached from the thread object and is no longer represented by a thread object-this is two separate things. The C + + thread object can be destroyed while the OS execution thread can continue

The member function joinable is used to detect if a thread requires a join. There are 3 joinable for false: 1.thread calls over detach; 2.thread has already been join; 3.thread is empty.

C + + 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.