Join And Detach In C++

Описание к видео Join And Detach In C++

JOIN ME
—————
YouTube 🎬    / @cppnuts  
Patreon 🚀   / cppnuts  

COMPLETE PLAYLIST
————————————
C++ Tutorial For Beginners:    • Introduction To C++  
STL (Standard Template Library):    • STL In C++  
ThreadIng In C++:    • Multithreading In C++  
Data Structures:    • Data Structure  
Algorithms:    • Binary Search  
Design Patterns:    • Factory Design Pattern in C++  
Smart Pointers:    • Smart Pointer In C++  
C++14:    • Digit Separator In C++  
C++17:    • std string_view in C++17 | Fastest St...  
C++ All Type Casts:    • static_cast In C++  


INTERVIEW PLAYLIST
————————————
C++ Interview Q&A:    • Structural Padding & Packing In C & C++  
C++ Interview Q&A For Experienced:    • How delete[] Knows How Much  To Deall...  
Linked List Interview Questions:    • Find Kth Node From Back In Singly Lin...  
BST Interview Questions:    • Search Element In Binary Search Tree ...  
Array Interview Questions:    • Reverse An Array  
String Interview Questions:    • Check String Is Palindrome Or Not  
Bit Manipulation Questions:    • Find Set Bit In Integer Number  
Binary Tree Interview Question:    • Invert Binary Tree  
Sorting Algorithms:    • Bubble Sort  
C++ MCQ:    • Видео  
C MCQ:    • What printf returns after printing? |...  
C Interview Questions:    • Designated Initialization In C  

QUICK SHORT VIDEOS
————————————-
C++ Short :    • C++ Short Videos  
C Short :    • Shorts C Programming MCQ  

In this video we will learn about what is the Use Of join(), detach() and joinable() In Thread In C++ (C++11)

JOIN NOTES
0. Once a thread is started we wait for this thread to finish by calling join() function on thread object.
1. Double join will result into program termination.
2. If needed we should check thread is joinable before joining. ( using joinable() function)

DETACH NOTES
0. This is used to detach newly created thread from the parent thread.
1. Always check before detaching a thread that it is joinable otherwise we may end up double detaching and
double detach() will result into program termination.
2. If we have detached thread and main function is returning then the detached thread execution is suspended.

NOTES:
Either join() or detach() should be called on thread object, otherwise during thread object�s destructor it will
terminate the program. Because inside destructor it checks if thread is still joinable? if yes then it terminates the program.

#threading #cpp #programming #tutorial #computerscience #softwareengineering

Комментарии

Информация по комментариям в разработке