Hi
I want to execute a delegate asynchronously with something like
Action.BeginInvoke that doesn’t seem to work, also using
BackgroundWorker I
get no result.
bw = System::ComponentModel::BackgroundWorker.new
bw.do_work { #do some work here, but never seems to get executed }
in C# public delegate void VoidHandler();
in IronRuby: VoidHandler.new{ #do some work her, but never seems to get
executed }.begin_invoke(nil, nil)
So
VoidHandler.new{ File.open(‘threading.txt’, ‘w’){ |f| f << “writing from
thread” } }.begin_invoke(nil, nil)
never creates the file threading.txt
But using the ThreadPool myself does work properly and creates a file
threading2.txt
$cb = WaitCallback.new { File.open(“threading2.txt” , ‘w’){|f| f <<
“From Thread” }
=> #System::Threading::WaitCallback:0x0000066System::Threading::ThreadPool.queue_user_work_item $cb, nil
=> true
Thanks
Ivan