aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/transport/chttp2/stream_encoder.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-10-09 17:40:19 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-10-09 18:12:09 -0700
commit63bda56884f1dece057f84dc6f94f9c2a5ce1605 (patch)
treeb23ede176c1951a1e33f575e770daf2626668e0d /src/core/transport/chttp2/stream_encoder.c
parent4d1fc5526160470b7d50a78062b80c0f5f4229e4 (diff)
Make metadata unref atomic
We used to need to lock the metadata context to unref an mdelem. This change makes it possible to lock only when the mdelem refcount would reach zero.
Diffstat (limited to 'src/core/transport/chttp2/stream_encoder.c')
-rw-r--r--src/core/transport/chttp2/stream_encoder.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/core/transport/chttp2/stream_encoder.c b/src/core/transport/chttp2/stream_encoder.c
index 83227e677d..2cbf90fb84 100644
--- a/src/core/transport/chttp2/stream_encoder.c
+++ b/src/core/transport/chttp2/stream_encoder.c
@@ -584,7 +584,6 @@ void grpc_chttp2_encode(grpc_stream_op *ops, size_t ops_count, int eof,
size_t max_take_size;
gpr_uint32 curop = 0;
gpr_uint32 unref_op;
- grpc_mdctx *mdctx = compressor->mdctx;
grpc_linked_mdelem *l;
int need_unref = 0;
gpr_timespec deadline;
@@ -650,17 +649,15 @@ void grpc_chttp2_encode(grpc_stream_op *ops, size_t ops_count, int eof,
finish_frame(&st, 1, eof);
if (need_unref) {
- grpc_mdctx_lock(mdctx);
for (unref_op = 0; unref_op < curop; unref_op++) {
op = &ops[unref_op];
if (op->type != GRPC_OP_METADATA) continue;
for (l = op->data.metadata.list.head; l; l = l->next) {
- if (l->md) GRPC_MDCTX_LOCKED_MDELEM_UNREF(mdctx, l->md);
+ if (l->md) GRPC_MDELEM_UNREF(l->md);
}
for (l = op->data.metadata.garbage.head; l; l = l->next) {
- GRPC_MDCTX_LOCKED_MDELEM_UNREF(mdctx, l->md);
+ GRPC_MDELEM_UNREF(l->md);
}
}
- grpc_mdctx_unlock(mdctx);
}
}