Deadlock?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!
I have a serious problem with what appears to be a deadlock in .NET cf. It
occures when I invoke Invalidate on a control from a thread other than the
main thread when the main thread is busy (i.e. displaying a form).

I have a situation similiar to this:

public class MyForm : System.Windows.Forms.Form
{

// ...

private void MyThreadedMethod()
{
while(true)
{
myLabel.Text = "..."; // This hangs the application if the main
thread is busy.
System.Threading.Thread.Sleep(1000);
}
}

// ...

}

How can I avoid this?

Thanks in advance!
Nille
 
Thank you very, very much for responding! I hope this will solve my problem
(haven't been able to try it yet)!

Nille
 
Back
Top