Firing events on a differnet thread

P

Phil Jones

I've just been thinking about scenarious where firing an event causes a
number of handler to execute - all of them potentially taking some time to
complete. With a UI control, that could be a problem. The answer of course
is to use threads - but I was wondering what the rule of thumb was here.

I've steared clear form firing the event on a different thread as I could
see how that could begin to be a real nightmare to debug (so handle thread
creation/management by the various handers).

But I thought I'd ask. Firing the event on a different thread would be a
single clean place to create the new thread. Does anyone have any
opinions/advice here???

Thanks everyone.
===
Phil : NZ
 
D

David Levine

You can fire the event on any thread you like, but you must access a control
only on the thread on which it was created. Fortunately there's a simple
pattern you can use to achieve this..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top