InvokeRequired for classes?

  • Thread starter Thread starter BoloBaby
  • Start date Start date
B

BoloBaby

Earlier, I had a threading issue where I had to use the InvokeRequired to
get my controls to function properly.

Does InvokeRequired apply to my custom classes as well? That is, if I have
attempt to fire a method in a custom class as the result of an event raised
by a user control, and the method doesn't seem to fire, is that because I
have a threading problem again?

What do I have to do in this case? Implement ISynchronizeInvoke on my
custom class?

Thanks.
 
BoloBaby said:
Earlier, I had a threading issue where I had to use the
InvokeRequired to get my controls to function properly.

Does InvokeRequired apply to my custom classes as well?

No. You only have to know if instances of your classes (or the shared
methods) are thread-safe. That's a design question how to ensure it.
That is, if
I have attempt to fire a method in a custom class as the result of an
event raised by a user control, and the method doesn't seem to fire,
is that because I have a threading problem again?

What do I have to do in this case? Implement ISynchronizeInvoke on
my custom class?

Do you have some steps to reproduce the problem?


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Well, actually...

The class whose method is failing to run is a Collection class, so there may
be a threading issue there. I haven't been able to make heads or tails of
the documentation on making collection classes thread-safe. Do you have any
links to a good article on this subject?

Also, if I happen to use Invoke anyway, will that cause problems?

Thanks.
 
Back
Top