Re: Cross thread question .....



Hey,

What if you create a delegate and pass this delegate as a parameter to your
thread? The delegate would be within the same context as the main thread. I
did this already before and works just fine.

--
Regards,
Robson Siqueira
Enterprise Architect
<temp2@xxxxxxxxxx> wrote in message
news:1170357675.751486.298030@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I have an app that reads data params from a stream and updates
controls accordingly. The stream reader is on a different thread than
the main thread that created the controls. I fully realize it's not
wise, and in some circumstances, not even possible to update the
controls from the stream other than the main stream. I believe there
are two recommended ways to handle this situation.

1. Use Invoke() to "call" an updater method on the main thread from
the stream reader thread.

2. Use the BackgroundWorker class and update controls with the
RunWorkerCompleted event handler.
Question is: Which one is better? I have to update about 75 controls
at a 10Hz rate (10 times a second) so I'm looking for speed here.
TIA

using 2.0, VS2005



.


Loading