[Ironruby-core] Asynchronous Delegates

Ivan Porto Carrero ivan at whiterabbitconsulting.eu
Thu Feb 11 08:51:42 EST 2010


or take a look here: I think the threadpool code is the one you want but
it's commented out right now

http://github.com/casualjim/ironnails/blob/master/IronNails/vendor/iron_nails/lib/nails_engine.rb#L61
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
GSM: +32.486.787.582
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)



On Thu, Feb 11, 2010 at 2:08 PM, Mark Rendle <mark at markrendle.net> wrote:

> Hi Bassel,
>
> Ruby provides its own support for asynchronous operations in its Thread
> class:
>
> Thread.new do
>   puts "howdy!"
> end
>
> If you specifically need to run a .NET delegate asynchronously, you can
> call its invoke method within this structure:
>
> Thread.new do
>   my_action.invoke
> end
>
>  More info on Ruby's Thread class:
> http://corelib.rubyonrails.org/classes/Thread.html
>
> Does that meet your needs?
>
> Cheers,
> Mark
>
> On Wed, Feb 10, 2010 at 11:25 PM, Bassel Samman <lists at ruby-forum.com>wrote:
>
>> Hello guys,
>>    I'd like to use asynchronous delegates, but it doesn't seem to work.
>> The IronRuby website mentioned that I can do:
>>
>> ______________________________________________________________________
>> >>> require 'System'
>> => true
>> >>> require 'System.Core, Version=3.5.0.0, Culture=neutral,
>> PublicKeyToken=b77a5c561934e089'
>> => true
>> >>> my_action = System::Action.new { puts "Howdy!" }
>> => System.Action
>> >>> my_action.invoke
>> "Howdy!"
>> => nil
>> ______________________________________________________________________
>> That works fine, but if I try this instead:
>>
>> ______________________________________________________________________
>> result = my_action.BeginInvoke(nil,nil)
>> my_action.EndInvoke(result)
>> ______________________________________________________________________
>>
>> I get:
>>
>> System::NullReferenceException: Object reference not set to an instance
>> of an object.
>>
>>
>> Am I missing something, or is there another way to do asynchronous
>> delegates in IR.
>>
>> Thanks in advance,
>>
>> Bassel
>> --
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100211/59168b8f/attachment-0001.html>


More information about the Ironruby-core mailing list