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

            lock (myLock)
            {
                value = dict[key];
                dict.Remove(key);
            }
            environment.DebugStats.PendingBatchCompletions.Decrement();
            return(value);
        }
 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();
     }
 }
        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();
                }
            }
        }
        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);
        }