private NdrDeferralStackEntry Push(bool allocate)
 {
     if (allocate)
     {
         NdrUtils.WriteLine($"Pushing new queue entry Empty: {Empty}");
         _stack.Push(new List <Action>());
         return(new NdrDeferralStackEntry(_stack));
     }
     return(null);
 }
        public void Add(Action a)
        {
            Action deferral = () =>
            {
                using (var queue = Push(true))
                {
                    a();
                }
            };

            System.Diagnostics.Debug.Assert(!Empty);
            NdrUtils.WriteLine("Adding deferred entry");
            _stack.Peek().Add(deferral);
        }
        void IDisposable.Dispose()
        {
            if (_stack == null)
            {
                return;
            }

            var list = _stack.Pop();

            System.Diagnostics.Debug.Assert(list == _list);
            NdrUtils.WriteLine($"Flushing {list.Count} queued entries");

            foreach (var a in list)
            {
                a();
            }
        }
Exemplo n.º 4
0
 private void Align(int alignment)
 {
     _stm.Position += NdrNativeUtils.CalculateAlignment((int)_stm.Position, alignment);
     NdrUtils.WriteLine($"Pos: {_stm.Position} - Align: {alignment}");
 }