Commit ee37da0a authored by Eugene Brevdo's avatar Eugene Brevdo Committed by TensorFlower Gardener
Browse files

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
parent 8e5f58c7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment