<p>A thread safe producer consumer queue implementation. It allows the standard push and pop operations. It also maintains a monotonically-increasing element position and allows peeking at the element at certain position. </p>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00028">28</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname"><aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::<aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a></td>
<p>Create a <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a> starting from position 0. </p><dlclass="params"><dt>Parameters</dt><dd>
<tr><tdclass="paramname">capacity</td><td>is the maximum number of elements that the queue can hold at once. A value of zero means unlimited capacity. </td></tr>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00138">138</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname"><aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::<aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a></td>
<p>Create a <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">ProducerConsumerQueue</a> starting from indicated position. </p><dlclass="params"><dt>Parameters</dt><dd>
<tr><tdclass="paramname">capacity</td><td>is the maximum number of elements that the queue can hold at once. A value of zero means unlimited capacity. </td></tr>
<tr><tdclass="paramname">starting_pos</td><td>is the starting head position. </td></tr>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00147">147</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">bool <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Empty </td>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00088">88</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">size_t <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::HeadPos </td>
<dlclass="section return"><dt>Returns</dt><dd>The position of the head element in the queue. Note that the returned value may be meaningless if the queue is empty. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00101">101</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname"><aclass="el"href="../../d2/d20/classshaka_1_1Status.html">Status</a><aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Peek </td>
<p>Peek at the element at the specified position from the queue. If the element is not available yet, block until it to be available or time out or stopped. NOTE: Elements before (pos - capacity/2) will be removed from the queue after Peek operation. </p><dlclass="params"><dt>Parameters</dt><dd>
<tr><tdclass="paramdir"></td><tdclass="paramname">pos</td><td>refers to the element position. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">element</td><td>receives the peeked element. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">timeout_ms</td><td>indicates timeout in milliseconds. A value of zero means return immediately. A negative value means waiting indefinitely. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>STOPPED if Stop has been called and <em>pos</em> is out of range, INVALID_ARGUMENT if the pos < Head(), TIME_OUT if times out, OK otherwise. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00252">252</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname"><aclass="el"href="../../d2/d20/classshaka_1_1Status.html">Status</a><aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Pop </td>
<p>Pop an element from the front of the queue. If the queue is empty, block for an element to be available to be consumed or time out or stopped. </p><dlclass="params"><dt>Parameters</dt><dd>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">element</td><td>receives the popped element. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">timeout_ms</td><td>indicates timeout in milliseconds. A value of zero means return immediately. A negative value means waiting indefinitely. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>STOPPED if Stop has been called and the queue is completely empty, TIME_OUT if times out, OK otherwise. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00210">210</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname"><aclass="el"href="../../d2/d20/classshaka_1_1Status.html">Status</a><aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Push </td>
<p>Push an element to the back of the queue. If the queue has reached its capacity limit, block until spare capacity is available or time out or stopped. </p><dlclass="params"><dt>Parameters</dt><dd>
<tr><tdclass="paramname">element</td><td>refers the element to be pushed. </td></tr>
<tr><tdclass="paramname">timeout_ms</td><td>indicates timeout in milliseconds. A value of zero means return immediately. A negative value means waiting indefinitely. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>OK if the element was pushed successfully, STOPPED if Stop has has been called, TIME_OUT if times out. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00161">161</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">size_t <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Size </td>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00094">94</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">void <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Stop </td>
<p>Terminate Pop and Peek requests once the queue drains entirely. Also terminate all waiting and future Push requests immediately. Stop cannot stall. </p>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00079">79</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">bool <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::Stopped </td>
<dlclass="section return"><dt>Returns</dt><dd>true if the queue has been stopped using <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html#ac600977b708381facf07f87e36b43d79">Stop()</a>. This allows producers to check if they can add new elements to the queue. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00115">115</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>
<tdclass="memname">size_t <aclass="el"href="../../d5/d33/classshaka_1_1media_1_1ProducerConsumerQueue.html">shaka::media::ProducerConsumerQueue</a>< T >::TailPos </td>
<dlclass="section return"><dt>Returns</dt><dd>The position of the tail element in the queue. Note that the returned value may be meaningless if the queue is empty. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html#l00108">108</a> of file <aclass="el"href="../../d5/d15/producer__consumer__queue_8h_source.html">producer_consumer_queue.h</a>.</p>