From: uncutstone wu Date: 2006-05-18T14:37:44+09:00 Subject: Re: Asynchronous calls in DRb Eric Hodel wrote: > The easiest way is to use threads. The next easiest way is to write > an asynchronous library without DRb then modify it to use DRb. > Yes, it is quite easy to implement asynchronous call using thread. Here is the code. class AsyncHello def asyncHello(arg) puts "hello called, arg is #{arg}" Thread.new(arg) {|arg| #trick: how to implement asynchronous call using thread hello(arg) } end def hello(arg) sleep 5 puts "Hello #{arg}" end end def testasyncall o = AsyncHello.new o.asyncHello("John") puts "This should be displayed before hello john" sleep(10) end testasyncall result: hello called, arg is John This should be displayed before hello john Hello John Best regards. uncutstone -- Posted via http://www.ruby-forum.com/.