Ejemplo n.º 1
0
 protected override unsafe void UseBufferPointerImpl(UseBufferPointerDelegate action)
 {
     fixed(byte *ptr = this.buffer)
     {
         action(ptr, this.Length);
     }
 }
Ejemplo n.º 2
0
        public unsafe void UseBufferPointer(UseBufferPointerDelegate action)
        {
            if (action is null)
            {
                ExceptionUtil.ThrowArgumentNullException(nameof(action));
            }

            VerifyNotDisposed();

            UseBufferPointerImpl(action);
        }
Ejemplo n.º 3
0
        protected override unsafe void UseBufferPointerImpl(UseBufferPointerDelegate action)
        {
            byte *ptr = null;

            RuntimeHelpers.PrepareDelegate(action);
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                this.buffer.AcquirePointer(ref ptr);

                action(ptr, this.Length);
            }
            finally
            {
                if (ptr != null)
                {
                    this.buffer.ReleasePointer();
                }
            }
        }
Ejemplo n.º 4
0
 protected abstract unsafe void UseBufferPointerImpl(UseBufferPointerDelegate action);