From: timsuth@... (Tim Sutherland) Date: 2005-04-16T13:54:35+09:00 Subject: Re: Ruby Weekly News 4th - 10th April 2005 In article , Martin DeMello wrote: >Tim Sutherland wrote: >> >> Detecting thread exit immediately >> --------------------------------- >> >> Martin DeMello was busy developing his fxirb application (a GUI wrapper >> around IRB), and had some code that started a Thread whenever it needed to >> launch an IRB session. How could he tell as soon as the Thread had ended? >> >> "Is there any way I can have FXIrb pass in `self' to the thread so that it >> can call methods on it?" >> >> He later reported that the helpful people in the #ruby-lang IRC channel >> had provided him with the solution, >> >> @irb = Thread.new(self) { >> .... >> self.quit_method >> } > >My bad - I mixed the two methods up when posting: > >@irb = Thread.new { > ... > self.quit_method # using the fact that the block is a closure with > # self in scope >} > >and > >@irb = Thread.new(self) {|obj| > ... > obj.quit_method # explicitly passing in self as a parameter >} Thanks, I've updated the website with the the first version.