Skip to content

Instantly share code, notes, and snippets.

@picanumber
Last active August 17, 2021 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save picanumber/f1c9169d457bfddd9b2bcae1131a434a to your computer and use it in GitHub Desktop.
Save picanumber/f1c9169d457bfddd9b2bcae1131a434a to your computer and use it in GitHub Desktop.
class X
{
int i = 0;
public:
int f(const char *msg) const
{
return i++;
}
};
Locking<X> aa(X{});
aa->f(msg); // This call is thread-safe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment