Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33866
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'puts': 0.07; 'python': 0.09; 'called.': 0.09; 'subject:Why': 0.09; 'thrown': 0.09; 'cc:addr:python-list': 0.10; 'thread': 0.11; 'yet.': 0.13; 'already,': 0.16; 'end-to-end': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'inserting': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'non- empty': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'run.': 0.16; 'simpson': 0.16; 'wrote:': 0.17; 'appears': 0.18; 'load': 0.19; 'import': 0.21; 'pipe': 0.22; 'cc:2**0': 0.23; 'transfers': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'thanks!': 0.26; 'am,': 0.27; 'skip:# 10': 0.27; 'run': 0.28; 'cat': 0.29; 'queue': 0.29; 'objects': 0.29; 'fri,': 0.30; 'anybody': 0.32; 'could': 0.32; 'print': 0.32; 'controlling': 0.33; 'likely': 0.33; 'nov': 0.35; 'subject:?': 0.35; 'there': 0.35; 'but': 0.36; 'received:au': 0.36; "i'll": 0.36; 'should': 0.36; 'charset:us- ascii': 0.36; 'uses': 0.37; 'why': 0.37; 'item': 0.37; 'far': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'help': 0.40; 'end': 0.40; 'content-disposition:inline': 0.60; 'most': 0.61; 'first': 0.61; 'chance': 0.61; 'become': 0.65; 'day': 0.73; 'feeder': 0.84; 'skip:~ 60': 0.84; 'ban': 0.91; 'roads': 0.91 |
| Date | Sat, 24 Nov 2012 09:19:39 +1100 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | Ian Kelly <ian.g.kelly@gmail.com> |
| Subject | Re: Why queue.empty() returns False even after put() is called? |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <CALwzid=JtEf30+JaqUN9M2we21mGQiWMGuQ6XR2XJ+-=PCY7Yw@mail.gmail.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <CALwzid=JtEf30+JaqUN9M2we21mGQiWMGuQ6XR2XJ+-=PCY7Yw@mail.gmail.com> |
| Cc | Python <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.243.1353709191.29569.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1353709191 news.xs4all.nl 6861 [2001:888:2000:d::a6]:43574 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33866 |
Show key headers only | View raw
On 23Nov2012 11:53, Ian Kelly <ian.g.kelly@gmail.com> wrote: | On Fri, Nov 23, 2012 at 9:57 AM, Peng Yu <pengyu.ut@gmail.com> wrote: | > The empty() returns True even after put() has been called. Why it is | > empty when there some items in it? Could anybody help me understand | > it? Thanks! | > | > ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat | > main.py | > #!/usr/bin/env python | > | > import multiprocessing | > | > queue = multiprocessing.Queue() | > print queue.empty() | > queue.put(['a', 'b']) | > queue.put(['c', 'd']) | > print queue.empty() | | According to the docs, the Queue uses a background thread to load data into it: | | When a process first puts an item on the queue a feeder thread is | started which transfers objects from a buffer into the pipe. | | Most likely it still appears to be empty because this thread has not | had a chance to run yet. If you try inserting a time.sleep() call, | you should see the queue become non-empty once the background thread | has run. Conversely, might it not appear empty because the objects have been thrown at the pipe already, appearing to have been consumed? Or is there end-to-end handshaking controlling what .empty() tests? (Though again, the far end may have grabbed them already too.) -- Cameron Simpson <cs@zip.com.au> The ZZR-1100 is not the bike for me, but the day they invent "nerf" roads and ban radars I'll be the first in line......AMCN
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Why queue.empty() returns False even after put() is called? Cameron Simpson <cs@zip.com.au> - 2012-11-24 09:19 +1100
csiph-web