Article View: pl.comp.lang.ruby
Article #1280Re: wątki same się kończą
From: luckboy
Date: Tue, 20 Oct 2009 09:03
Date: Tue, 20 Oct 2009 09:03
22 lines
1431 bytes
1431 bytes
pawel pisze: > Czemu w poniższym kodzie zamiast dużej ilości 'lala' na wyjściu nie > dostaje nic, a program od razu się kończy? > Przecież tam powinien chodzić nieskończony wątek i dawać jakis output > cały czas. > class Bar > def initialize > > end > def foo > Thread.new do > while true > puts "lala\n" > end > end > end > end > > b=Bar.new > b.foo Po prostu musisz poczekać na wątek z za pomocą metody join.
Technical Details
Message-ID:
<hbjud2$ajf$1@news.onet.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!news.onet.pl!not-for-mailReferences:
<78ded556-fad5-4963-a81f-06078a37a7d4@l35g2000vba.googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!news.onet.pl!not-for-mail From: luckboy <luckboy@vp.pl> Newsgroups: pl.comp.lang.ruby Subject: Re: wątki same się kończą Date: Tue, 20 Oct 2009 11:03:17 +0200 Organization: http://onet.pl Lines: 22 Message-ID: <hbjud2$ajf$1@news.onet.pl> References: <78ded556-fad5-4963-a81f-06078a37a7d4@l35g2000vba.googlegroups.com> Reply-To: luckboy@vp.pl NNTP-Posting-Host: adti174.neoplus.adsl.tpnet.pl Mime-Version: 1.0 X-Trace: news.onet.pl 1256029410 10863 79.185.220.174 (20 Oct 2009 09:03:30 GMT) X-Complaints-To: niusy@onet.pl NNTP-Posting-Date: Tue, 20 Oct 2009 09:03:30 +0000 (UTC) User-Agent: Thunderbird 2.0.0.22 (X11/20090719) In-Reply-To: <78ded556-fad5-4963-a81f-06078a37a7d4@l35g2000vba.googlegroups.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit