From 86c0f8adb8238a923b56bdecf7cf52395d4f31f1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 1 Dec 2015 20:05:40 -0800 Subject: Make pick_first fast path lock free, take channel lock for less time --- src/core/channel/client_channel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/core/channel/client_channel.c') diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index da0fdba643..bd8fa70034 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -338,10 +338,13 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp, return 1; } if (chand->lb_policy != NULL) { - int r = - grpc_lb_policy_pick(exec_ctx, chand->lb_policy, calld->pollset, - initial_metadata, connected_subchannel, on_ready); + grpc_lb_policy *lb_policy = chand->lb_policy; + int r; + GRPC_LB_POLICY_REF(lb_policy, "cc_pick_subchannel"); gpr_mu_unlock(&chand->mu_config); + r = grpc_lb_policy_pick(exec_ctx, lb_policy, calld->pollset, + initial_metadata, connected_subchannel, on_ready); + GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "cc_pick_subchannel"); return r; } if (chand->resolver != NULL && !chand->started_resolving) { -- cgit v1.2.3