Add new ReffedStatusCallback util class. This class allows multiple threads to
update a status before the underlying callback is executed. The use pattern is:
auto cb = new ReffesStatusCallback(std::move(done));
auto execution = [cb](...) { if (cb->ok()) { cb->Ref(); ... } };
auto post_execution = [cb](const Status& s) { cb->SetStatus(s); cb->Unref(); }
Status r = CallAsyncOp(
..., std::move(execution), std::move(post_execution) /*done*/);
cb->SetStatus(r);
cb->Unref();
PiperOrigin-RevId: 170216176
Loading
Please sign in to comment