pthreads can be so ugly, in C++ you can use std::thread(since C++11, which it seems you are using right now)
It offers a more object-oriented interface, and handles creating/freeing the thread for you, and is portable to other platforms, allowing for easier cross-platform development.
While it isn't doesn't give you all of the functionality of pthreads, you can grab the underlying pthread handle from it, and call your usual pthread functions on it.
Try to replace pthread with std::thread
pthreads can be so ugly, in C++ you can use
std::thread
(since C++11, which it seems you are using right now) It offers a more object-oriented interface, and handles creating/freeing the thread for you, and is portable to other platforms, allowing for easier cross-platform development.While it isn't doesn't give you all of the functionality of pthreads, you can grab the underlying pthread handle from it, and call your usual pthread functions on it. Try to replace pthread with
std::thread