🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.ruby
2 messages
2 total messages Started by pawel Mon, 19 Oct 2009 15:07
=?ISO-8859-2?B?d7F0a2kgc2FtZSBzaeoga2/xY3qx?
#1253
Author: pawel
Date: Mon, 19 Oct 2009 15:07
21 lines
368 bytes
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

Re: =?ISO-8859-2?Q?w±tki_same_siê_koñcz±?
#1254
Author: luckboy
Date: Tue, 20 Oct 2009 11:03
23 lines
482 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ºr.new
> b.foo

Po prostu musisz poczeka� na w�tek z za pomoc� metody join.

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads