public override void Write(byte[] buffer, int offset, int count) { if (buffer.Length < offset + count) throw new IndexOutOfRangeException(); if (buffer.Length != 0) fixed (byte* pbuffer = &buffer[offset]) buf.Write((IntPtr)pbuffer, count); }
unsafe void a() { var buf = new IPCRingBuffer(); buf.Allocate(1024); bufid = buf.Id; int ctr = 0; for (; ; ) { Random r = new Random(ctr); ctr++; Console.WriteLine("Writing: {0}", ctr); byte[] temp = new byte[r.Next(2048) + 1]; r.NextBytes(temp); for (int i = 0; i < temp.Length; i++) lock (shazam) shazam.Enqueue(temp[i]); fixed (byte* tempptr = &temp[0]) buf.Write((IntPtr)tempptr, temp.Length); //Console.WriteLine("wrote {0}; ringbufsize={1}", temp.Length, buf.Size); } }
unsafe void a() { var buf = new IPCRingBuffer(); buf.Allocate(1024); bufid = buf.Id; int ctr = 0; for (; ; ) { Random r = new Random(ctr); ctr++; Console.WriteLine("Writing: {0}", ctr); byte[] temp = new byte[r.Next(2048) + 1]; r.NextBytes(temp); for (int i = 0; i < temp.Length; i++) lock (shazam) shazam.Enqueue(temp[i]); fixed (byte* tempptr = &temp[0]) buf.Write((IntPtr)tempptr, temp.Length); //Console.WriteLine("wrote {0}; ringbufsize={1}", temp.Length, buf.Size); } }