balance queuedContinuationCounter for inlined handlers

pull/13418/head
Jan Tattermusch 7 years ago
parent ea6cc57f1e
commit 1aacb19838
  1. 4
      src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs

@ -176,10 +176,10 @@ namespace Grpc.Core.Internal
try try
{ {
var callback = cq.CompletionRegistry.Extract(tag); var callback = cq.CompletionRegistry.Extract(tag);
// Use cached delegates to avoid unnecessary allocations queuedContinuationCounter.Increment();
if (!inlineHandlers) if (!inlineHandlers)
{ {
queuedContinuationCounter.Increment(); // Use cached delegates to avoid unnecessary allocations
ThreadPool.QueueUserWorkItem(success ? runCompletionQueueEventCallbackSuccess : runCompletionQueueEventCallbackFailure, callback); ThreadPool.QueueUserWorkItem(success ? runCompletionQueueEventCallbackSuccess : runCompletionQueueEventCallbackFailure, callback);
} }
else else

Loading…
Cancel
Save