Incorrect usage of threads

  • Thread starter Thread starter TonyJ
  • Start date Start date
T

TonyJ

Hello!

If I have a control in the form that is accessed by a different thread then
the one that was used when the control was created
I get "Cross-thread operation not valid: Control 'digital' accessed
from a thread other than the thread it was created on." which this mail is
about
As I have noticed this error appear only in debug mode and not in release
mode.

So the debugger inform me that usage of thread is not correct.

I have asked this question before and have not received any good answer.
So I hope to get a better anser this time
Now to the question if this error is not corrected what would the
consequences be ?
What symptom could I get when this program is put into production because of
incorrect usage of threads.

//Tony
 
what would the consequences be ?
What symptom could I get

Crashing (exeption and/or critical), hanging, garbage on the
display... you name it. Of course, you are now in a race condition, so
there is a good chance that you won't see *anything* until that moment
that both threads are toying with the same data.

Nobody can stop you, but *seriously* this is not a good idea.

Note that you are messing with .NET controls *and* win32 controls, so
it isn't as though the impact is restricted by what .NET does (i.e.
exceptions). Bad things will happen... "maybe not today, maybe not
tomorrow, but some day, soon..." etc

Marc
 

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

Back
Top