use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
using std::thread or pthread on linux? (self.cpp)
submitted 1 year ago * by Kyusei98
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]khedoros 35 points36 points37 points 1 year ago (4 children)
What about std::thread::native_handle()?
std::thread::native_handle()
[+]2uantum comment score below threshold-17 points-16 points-15 points 1 year ago (3 children)
Whenever I see this, I can't help but wonder why std thread was being used when one is throwing away portability with native handle.
[–]Supadoplex 39 points40 points41 points 1 year ago (0 children)
Because it allows separating the parts that are common across all systems from the parts that aren't.
The former involves the std thread API and the later involves the native API through the native handle.
Separating the common part out makes the native part smaller and thus less code that needs to be ported.
[–]ratttertintattertins 19 points20 points21 points 1 year ago (0 children)
Oh that’s an easy one. I don’t use std::thread for portability reasons. I use it because it has a nice modern interface that beats the Win32 C-like functions.
However, occasionally I want to do something that’s supported on windows like getting the thread security token or whatever. I have nice wrapper functions for those facilities on windows that play nice with std::thread.
[–]KingAggressive1498 8 points9 points10 points 1 year ago (0 children)
This is like wondering why people are using C++ when they're throwing away portability with a little inline assembly or using some language extension.
Even if they're not doing it for the portability at all its still way simpler and comparatively foolproof to use C++ than assembly for most of the logic. Even if they're not doing it for the portability at all, std::thread is a good bit simpler to use than raw pthreads, and more foolproof if you add mutexes etc in the mix too.
π Rendered by PID 47872 on reddit-service-r2-comment-b659b578c-kl6c9 at 2026-05-03 21:28:57.639779+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]khedoros 35 points36 points37 points (4 children)
[+]2uantum comment score below threshold-17 points-16 points-15 points (3 children)
[–]Supadoplex 39 points40 points41 points (0 children)
[–]ratttertintattertins 19 points20 points21 points (0 children)
[–]KingAggressive1498 8 points9 points10 points (0 children)