tgoop.com/embedded/2074
Last Update:
🔺Comparision of C++ and Posix Threads
✍️ B4b4k
What is the difference between using the C++ std threads and POSIX threads?
API: The API for C++ std threads and POSIX threads are different, with different function names and parameters. The C++ std thread library is part of the C++ standard library and provides a C++ interface, while the POSIX threads library is a separate library that provides a C interface.
Implementation: The implementation of C++ std threads and POSIX threads may differ depending on the specific platform and implementation details. C++ std threads are typically implemented using a combination of user-level and kernel-level threads, while POSIX threads are typically implemented using kernel-level threads.
Portability: C++ std threads are part of the C++ standard library, which makes them more portable than POSIX threads, which are a separate library and may not be available on all platforms.
Exception handling: C++ std threads support exception handling, while POSIX threads do not. This means that in C++ std threads, exceptions can be propagated across thread boundaries, while in POSIX threads, exceptions must be caught and handled within the same thread.
Synchronization primitives: C++ std threads provide a set of synchronization primitives, such as mutexes, condition variables, and atomic operations, that are designed to work with the C++ language and its memory model. POSIX threads provide similar synchronization primitives, but they are designed to work with the C language and may require more low-level manipulation of shared memory.
#Cpp
#Multithreading
#POSIX
@embedded
BY Embedded Academy

Share with your friend now:
tgoop.com/embedded/2074