When Queue.qsize() is not 0, but why is Queue.empty() True in python multiprocessing?
<p>everyone,
I have a question about Queue in multiprocessing:</p>

<p>I use Queue to exchange data with multi processes, two processes put and one process gets. But I find that:</p>

<ol>
<li><p>When queue.qsize() is not 0, but queue.empty() is True. And queue.get() is waiting too.</p></li>
<li><p>If queue.get() is waiting, when queue.put() is used in other process.</p></li>
</ol>

<p>Code:</p>

<pre><code>from multiprocessing import Queue

train_queue = Queue(maxsize = 50000)
****
**** Other Module
****
if train_queue.empty() == True:
        print "***** ", i, " **** queue is empty"
        print "***** queue.get, train_queue.qsize: ", train_queue.qsize()
        ti = time.time()
</code></pre>

<p>LOG:</p>

<pre><code>***** 10 **** queue is empty
***** queue.get, train_queue.qsize: 512
***** 102 **** queue is empty
***** queue.get, train_queue.qsize: 1233
***** 189 **** queue is empty
***** queue.get, train_queue.qsize: 1865
</code></pre>