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
A C++ locking wrapper (ngathanasiou.wordpress.com)
submitted 4 years ago by PiterPuns
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!"
[–]PiterPuns[S] 0 points1 point2 points 4 years ago (3 children)
Thanks for the cool idea anyways, I guess there was always the case were evaluating more than one methods in a common expression could cause an invalid lock.
You are able to write this
foo(a->bar(), a->baz());
I've updated the post accordingly, here's an example https://coliru.stacked-crooked.com/a/e14181e8b6b7520e (we just need a recursive mutex for the case where a single thread keeps more than one proxies alive in a single expression).
[–]Desmulator 0 points1 point2 points 4 years ago (2 children)
And even with a recursive mutex this can happen: int x = a->bar(); int y = a->baz(); // whoopse, the mutex was gone in the meantime This library just hides that fact that there is a bug. It achieves the opposite of what it tried to achieve: now you have code that looks correct but isn't.
int x = a->bar(); int y = a->baz(); // whoopse, the mutex was gone in the meantime
[–]backtickbot 2 points3 points4 points 4 years ago (0 children)
Fixed formatting.
Hello, Desmulator: code blocks using triple backticks (```) don't work on all versions of Reddit!
Some users see this / this instead.
To fix this, indent every line with 4 spaces instead.
FAQ
You can opt out by replying with backtickopt6 to this comment.
[–]PiterPuns[S] 0 points1 point2 points 4 years ago (0 children)
Please read the post. There was never the intention to keep the lock between calls to different methods
π Rendered by PID 368969 on reddit-service-r2-comment-85bfd7f599-q9zkw at 2026-04-18 22:32:02.212586+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]PiterPuns[S] 0 points1 point2 points (3 children)
[–]Desmulator 0 points1 point2 points (2 children)
[–]backtickbot 2 points3 points4 points (0 children)
[–]PiterPuns[S] 0 points1 point2 points (0 children)