unsafe void b()
			{
				var buf = new IPCRingBuffer();
				buf.Open(bufid);

				int ctr = 0;
				for (; ; )
				{
					Random r = new Random(ctr + 1000);
					ctr++;
					Console.WriteLine("Reading : {0}", ctr);

					int tryRead = r.Next(2048) + 1;
					byte[] temp = new byte[tryRead];
					fixed (byte* tempptr = &temp[0])
						buf.Read((IntPtr)tempptr, tryRead);
					//Console.WriteLine("read {0}; ringbufsize={1}", temp.Length, buf.Size);
					for (int i = 0; i < temp.Length; i++)
					{
						byte b;
						lock (shazam) b = shazam.Dequeue();
						Debug.Assert(b == temp[i]);
					}
				}
			}
		public override int Read(byte[] buffer, int offset, int count)
		{
			if (buffer.Length < offset + count) throw new IndexOutOfRangeException();
			if (buffer.Length != 0)
				fixed (byte* pbuffer = &buffer[offset])
					buf.Read((IntPtr)pbuffer, count);
			return count;
		}
Exemple #3
0
			unsafe void b()
			{
				var buf = new IPCRingBuffer();
				buf.Open(bufid);

				int ctr = 0;
				for (; ; )
				{
					Random r = new Random(ctr + 1000);
					ctr++;
					Console.WriteLine("Reading : {0}", ctr);

					int tryRead = r.Next(2048) + 1;
					byte[] temp = new byte[tryRead];
					fixed (byte* tempptr = &temp[0])
						buf.Read((IntPtr)tempptr, tryRead);
					//Console.WriteLine("read {0}; ringbufsize={1}", temp.Length, buf.Size);
					for (int i = 0; i < temp.Length; i++)
					{
						byte b;
						lock (shazam) b = shazam.Dequeue();
						Debug.Assert(b == temp[i]);
					}
				}
			}