Skip to content

Instantly share code, notes, and snippets.

@lcapaldo
Created March 9, 2012 00:38
Show Gist options
  • Save lcapaldo/2004350 to your computer and use it in GitHub Desktop.
Save lcapaldo/2004350 to your computer and use it in GitHub Desktop.
struct counter : resource { int c; } r;
counter r2;
std::function<bool(int&)> is7 = [](int& x) -> bool { return x == 7; };
r2.with_do([&]() {
if( r2.c != 7 )
{
std::cout << "Waiting for c to become 7.\n";
}
r.await(std::bind(is7, std::ref(r2.c))); // r != r2
std::cout << "c is 7!\n";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment