public BufferObject RemoveBufferItemFromQueue()
        {
            BufferObject tmpBO = null;

            // Not a while loop just so that write gaps are actually small.
            // And just enough sleep to not be processor hogging
            if (bufferObjectList.Count < 1 && active)
            {
                Thread.Sleep(10);
            }

            lock (lock_bufferobject)
            {
                if (bufferObjectList.Count > 0)
                {
                    tmpBO       = bufferObjectList[0];
                    buffersize -= tmpBO.buffer.Length;
                    bufferObjectList.RemoveAt(0);
                }
                if (peak && bufferObjectList.Count < smallbuffersize)
                {
                    collect = true;
                    peak    = false;
                }
            }
            return(tmpBO);
        }
Esempio n. 2
0
        public BufferObject RemoveBufferItemFromQueue()
        {
            BufferObject bufferObject = (BufferObject)null;

            if (this.bufferObjectList.Count < 1 && this.active)
            {
                Thread.Sleep(10);
            }
            lock (this.lock_bufferobject)
            {
                if (this.bufferObjectList.Count > 0)
                {
                    bufferObject     = this.bufferObjectList[0];
                    this.buffersize -= (long)bufferObject.buffer.Length;
                    this.bufferObjectList.RemoveAt(0);
                }
                if (this.peak && this.bufferObjectList.Count < this.smallbuffersize)
                {
                    this.collect = true;
                    this.peak    = false;
                }
            }
            return(bufferObject);
        }