|
|
@ -51,7 +51,7 @@ namespace Grpc.Core.Internal |
|
|
|
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<CompletionRegistry>(); |
|
|
|
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<CompletionRegistry>(); |
|
|
|
|
|
|
|
|
|
|
|
readonly GrpcEnvironment environment; |
|
|
|
readonly GrpcEnvironment environment; |
|
|
|
readonly ConcurrentDictionary<IntPtr, OpCompletionDelegate> dict = new ConcurrentDictionary<IntPtr, OpCompletionDelegate>(); |
|
|
|
readonly ConcurrentDictionary<IntPtr, OpCompletionDelegate> dict = new ConcurrentDictionary<IntPtr, OpCompletionDelegate>(new IntPtrComparer()); |
|
|
|
|
|
|
|
|
|
|
|
public CompletionRegistry(GrpcEnvironment environment) |
|
|
|
public CompletionRegistry(GrpcEnvironment environment) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -121,5 +121,21 @@ namespace Grpc.Core.Internal |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// IntPtr doesn't implement <c>IEquatable{IntPtr}</c> so we need to use custom comparer to avoid boxing. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
private class IntPtrComparer : IEqualityComparer<IntPtr> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public bool Equals(IntPtr x, IntPtr y) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return x == y; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int GetHashCode(IntPtr obj) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return obj.GetHashCode(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|