Skip to content

Instantly share code, notes, and snippets.

@chai2010
Forked from nicolasnoble/gist:a40a81db45db4f025601
Last active August 29, 2015 14:25
Show Gist options
  • Save chai2010/0e2c0c26a9de80e1c237 to your computer and use it in GitHub Desktop.
Save chai2010/0e2c0c26a9de80e1c237 to your computer and use it in GitHub Desktop.
void HandleRpcs() {
new CallData(&service_, cq_.get());
void* tag;
bool ok;
while (true) {
switch (cq_->AsyncNext(&tag, &ok, gpr_inf_past) {
case TIMEOUT:
doSomethingElseForALittleWhile();
continue;
case SHUTDOWN:
return;
case GOT_EVENT:
GPR_ASSERT(ok);
static_cast<CallData*>(tag)->Proceed();
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment