forbid BeginOp and EndOp for sync completion queue altogether

pull/19629/head
Jan Tattermusch 6 years ago
parent 7142d9e2dc
commit bc1283c43b
  1. 16
      src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs

@ -104,20 +104,16 @@ namespace Grpc.Core.Internal
private void BeginOp() private void BeginOp()
{ {
if (shutdownRefcount != null) GrpcPreconditions.CheckNotNull(shutdownRefcount, nameof(shutdownRefcount));
{ bool success = false;
bool success = false; shutdownRefcount.IncrementIfNonzero(ref success);
shutdownRefcount.IncrementIfNonzero(ref success); GrpcPreconditions.CheckState(success, "Shutdown has already been called");
GrpcPreconditions.CheckState(success, "Shutdown has already been called");
}
} }
private void EndOp() private void EndOp()
{ {
if (shutdownRefcount != null) GrpcPreconditions.CheckNotNull(shutdownRefcount, nameof(shutdownRefcount));
{ DecrementShutdownRefcount();
DecrementShutdownRefcount();
}
} }
// Allows declaring BeginOp and EndOp of a completion queue with a using statement. // Allows declaring BeginOp and EndOp of a completion queue with a using statement.

Loading…
Cancel
Save