From: "Lars M." Date: 2003-01-21T23:49:08+09:00 Subject: Re: Threading problem ... Thanks so much! Fixed code follows. #################################### def countdown 10.downto 0 do |number| puts number sleep 1 end end def newThread(code) Thread.start {code.call} end newThread(proc {countdown}) newThread(proc {countdown}) sleep 10 ##################################### ----- Original Message ----- From: To: "ruby-talk ML" Sent: Tuesday, January 21, 2003 3:42 PM Subject: Re: Threading problem ... > Hi -- > > On Tue, 21 Jan 2003, Lars M. wrote: > > > Right. So what's the solution? How can I pass a block of code as an > > argument? > > def run_me(block) > block.call > end > > run_me(proc { puts "running!" }) > > or: > > def run_me > yield > end > > run_me { puts "running!" } > > if you want to use the block technique (rather than sending a block > as an argument). > > > David > > -- > David Alan Black > home: dblack@candle.superlink.net > work: blackdav@shu.edu > Web: http://pirate.shu.edu/~blackdav > >