Ejemplo n.º 1
0
 public void Register(IntPtr key, IOpCompletionCallback callback)
 {
     environment.DebugStats.PendingBatchCompletions.Increment();
     lock (myLock)
     {
         dict.Add(key, callback);
         this.lastRegisteredKey = key;
     }
 }
Ejemplo n.º 2
0
        public IOpCompletionCallback Extract(IntPtr key)
        {
            IOpCompletionCallback value = null;

            lock (myLock)
            {
                value = dict[key];
                dict.Remove(key);
            }
            environment.DebugStats.PendingBatchCompletions.Decrement();
            return(value);
        }
Ejemplo n.º 3
0
 private void RunCompletionQueueEventCallback(IOpCompletionCallback callback, bool success)
 {
     try
     {
         callback.OnComplete(success);
     }
     catch (Exception e)
     {
         Logger.Error(e, "Exception occurred while invoking completion delegate");
     }
     finally
     {
         queuedContinuationCounter.Decrement();
     }
 }
Ejemplo n.º 4
0
        public void Register(IntPtr key, IOpCompletionCallback callback)
        {
            environment.DebugStats.PendingBatchCompletions.Increment();

            bool lockTaken = false;

            try
            {
                spinLock.Enter(ref lockTaken);

                dict.Add(key, callback);
                this.lastRegisteredKey = key;
            }
            finally
            {
                if (lockTaken)
                {
                    spinLock.Exit();
                }
            }
        }
Ejemplo n.º 5
0
        public IOpCompletionCallback Extract(IntPtr key)
        {
            IOpCompletionCallback value = null;
            bool lockTaken = false;

            try
            {
                spinLock.Enter(ref lockTaken);

                value = dict[key];
                dict.Remove(key);
            }
            finally
            {
                if (lockTaken)
                {
                    spinLock.Exit();
                }
            }
            environment.DebugStats.PendingBatchCompletions.Decrement();
            return(value);
        }