Skip to content

Commit

Permalink
Annotate lambda as requiring lock.
Browse files Browse the repository at this point in the history
This fixes errors visible with stricter clang checks

PiperOrigin-RevId: 244951550
  • Loading branch information
tensorflower-gardener committed Apr 24, 2019
1 parent a68d80d commit 43cd14e
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions tensorflow/core/kernels/lookup_table_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,21 @@ class LookupTableOp : public OpKernel {
use_node_name_sharing_));
}

auto creator = [ctx, this](lookup::LookupInterface** ret) {
lookup::LookupInterface* container = new Container(ctx, this);
if (!ctx->status().ok()) {
container->Unref();
return ctx->status();
}
if (ctx->track_allocations()) {
ctx->record_persistent_memory_allocation(
container->MemoryUsed() + table_handle_.AllocatedBytes());
}
*ret = container;
return Status::OK();
};
auto creator =
[ctx, this](lookup::LookupInterface** ret)
EXCLUSIVE_LOCKS_REQUIRED(mu_) {
lookup::LookupInterface* container = new Container(ctx, this);
if (!ctx->status().ok()) {
container->Unref();
return ctx->status();
}
if (ctx->track_allocations()) {
ctx->record_persistent_memory_allocation(
container->MemoryUsed() + table_handle_.AllocatedBytes());
}
*ret = container;
return Status::OK();
};

lookup::LookupInterface* table = nullptr;
OP_REQUIRES_OK(ctx,
Expand Down

0 comments on commit 43cd14e

Please sign in to comment.