Esempio n. 1
0
        public void RegisterRequestCallCompletion(RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
        {
            // TODO(jtattermusch): get rid of new delegate creation here
            OpCompletionDelegate opCallback = ((success) => HandleRequestCallCompletion(success, ctx, callback));

            Register(ctx.Handle, opCallback);
        }
Esempio n. 2
0
 public void Register(IntPtr key, OpCompletionDelegate callback)
 {
     environment.DebugStats.PendingBatchCompletions.Increment();
     lock (myLock)
     {
         dict.Add(key, callback);
         this.lastRegisteredKey = key;
     }
 }
Esempio n. 3
0
 public void Register(IntPtr key, OpCompletionDelegate callback)
 {
     lock (dict)
     {
         environment.DebugStats.PendingBatchCompletions.Increment();
         GrpcPreconditions.CheckState(!dict.ContainsKey(key));
         dict.Add(key, callback);
     }
 }
Esempio n. 4
0
 private static void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success)
 {
     try
     {
         callback(success);
     }
     catch (Exception e)
     {
         Logger.Error(e, "Exception occured while invoking completion delegate");
     }
 }
Esempio n. 5
0
        public OpCompletionDelegate Extract(IntPtr key)
        {
            OpCompletionDelegate value = null;

            lock (myLock)
            {
                value = dict[key];
                dict.Remove(key);
            }
            environment.DebugStats.PendingBatchCompletions.Decrement();
            return(value);
        }
Esempio n. 6
0
        public void NativeCallbackBenchmark()
        {
            OpCompletionDelegate handler = Handler;

            counter = 0;
            BenchmarkUtil.RunBenchmark(
                1000000, 10000000,
                () =>
            {
                Native.grpcsharp_test_callback(handler);
            });
            Assert.AreNotEqual(0, counter);
        }
Esempio n. 7
0
 private void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success)
 {
     try
     {
         callback(success);
     }
     catch (Exception e)
     {
         Logger.Error(e, "Exception occured while invoking completion delegate");
     }
     finally
     {
         queuedContinuationCounter.Decrement();
     }
 }
Esempio n. 8
0
 internal static extern CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] OpCompletionDelegate callback);
Esempio n. 9
0
 public void Register(IntPtr key, OpCompletionDelegate callback)
 {
     environment.DebugStats.PendingBatchCompletions.Increment();
     GrpcPreconditions.CheckState(dict.TryAdd(key, callback));
 }
Esempio n. 10
0
        public void RegisterBatchCompletion(BatchContextSafeHandle ctx, BatchCompletionDelegate callback)
        {
            OpCompletionDelegate opCallback = ((success) => HandleBatchCompletion(success, ctx, callback));

            Register(ctx.Handle, opCallback);
        }
Esempio n. 11
0
 public void Register(IntPtr key, OpCompletionDelegate callback)
 {
     DebugStats.PendingBatchCompletions.Increment();
     Preconditions.CheckState(dict.TryAdd(key, callback));
 }
Esempio n. 12
0
        public void RegisterRequestCallCompletion(RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback)
        {
            OpCompletionDelegate opCallback = ((success) => HandleRequestCallCompletion(success, ctx, callback));

            Register(ctx.Handle, opCallback);
        }
Esempio n. 13
0
 public void Register(IntPtr key, OpCompletionDelegate callback)
 {
     environment.DebugStats.PendingBatchCompletions.Increment();
     GrpcPreconditions.CheckState(dict.TryAdd(key, callback));
     this.lastRegisteredKey = key;
 }