Article View: pl.comp.lang.perl
Article #51721Re: Thread::Queue a pusty hash na wyjsciu
From: Szymon Sokół
Date: Wed, 23 Dec 2009 23:15
Date: Wed, 23 Dec 2009 23:15
18 lines
1885 bytes
1885 bytes
On Wed, 23 Dec 2009 21:31:04 +0100, Vava wrote: >> while (my $ref= $queue->dequeue()) > > Źle - wyjdzie Ci z pętli jak tylko kolejka stanie się pusta, w szczególnym > przypadku, gdy drugi wątek zacznie działać przed tym, nim pierwszy skończy > pierwszego sleepa, to w ogóle nic nie zrobi. Zaraz, dlaczego? To jest dequeue(), nie dequeue_nb(), które zwróciłoby undef przy pustej kolejce; dequeue() powinno czekać, aż coś się w kolejce znajdzie... -- Szymon Sokół (SS316-RIPE) -- Network Manager B Computer Center, AGH - University of Science and Technology, Cracow, Poland O http://home.agh.edu.pl/szymon/ PGP key id: RSA: 0x2ABE016B, DSS: 0xF9289982 F Free speech includes the right not to listen, if not interested -- Heinlein H
Technical Details
Message-ID:
<i610p8owlore.dlg@falcon.sloth.hell.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!dustpuppy.sloth.hell.pl!not-for-mailReferences:
<hgth64$21l6$1@news.mm.pl> <op.u5eq920vxt9k2g@ubik>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!dustpuppy.sloth.hell.pl!not-for-mail
From: Szymon Sokół
<szymon@bastard.operator.from.hell.pl>
Newsgroups: pl.comp.lang.perl
Subject: Re: Thread::Queue a pusty hash na wyjsciu
Date: Thu, 24 Dec 2009 00:15:06 +0100
Organization: Guy Fawkes Society
Lines: 18
Sender: szymon@news.agh.edu.pl
Message-ID: <i610p8owlore.dlg@falcon.sloth.hell.pl>
References: <hgth64$21l6$1@news.mm.pl> <op.u5eq920vxt9k2g@ubik>
NNTP-Posting-Host: chello089079192166.chello.pl
Mime-Version: 1.0
X-Trace: news.agh.edu.pl 1261610154 1082 89.79.192.166 (23 Dec 2009 23:15:54 GMT)
X-Complaints-To: abuse@agh.edu.pl
NNTP-Posting-Date: Wed, 23 Dec 2009 23:15:54 +0000 (UTC)
User-Agent: 40tude_Dialog/2.0.15.1 Hamster/2.1.0.11
X-Face: xic?6f"rD)k-tM.]L]A6l4W7_aGt({}&{D,hiRI.8cPtf,1F.w@Qkl!vr23o1UY-BfXO$p< hk5>ijB?eBy)?!C<@)+%U\&`1X)MJ>.i.qgkY]4mvL62j<|xJRG/5:7:l8q]x;v!)Bz^r/!yG8DxoD -@fnC,g]BAXj
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit